Skip to content
Snippets Groups Projects
Commit 56f4d84a authored by tnias's avatar tnias
Browse files

Add PoC CLI

parent b77d8157
No related branches found
No related tags found
No related merge requests found
......@@ -48,7 +48,6 @@ Size | Encoding | Description
## To-do
- [ ] write example CLI that pretty prints the fixture's contents
- [ ] maybe add something (tests!?) that allows for better/easier debugging
- [ ] find out how to properly debug
/target/
**/*.rs.bk
Cargo.lock
[package]
name = "drumdump"
version = "0.1.0"
authors = ["Phil <phil@grmr.de>"]
[dependencies]
nom = "3.2"
[dependencies.drumchallenge]
path = "../.."
extern crate drumchallenge;
extern crate nom;
use drumchallenge::parse;
use nom::IResult;
use std::io::prelude::*;
use std::fs::File;
use std::env;
fn main() {
if let Some(arg1) = env::args().nth(1) {
let filepath = arg1;
let mut buf: Vec<u8> = vec![];
let mut file = File::open(filepath).expect("file exists");
let _ = file.read_to_end(&mut buf).expect("file can be read");
match parse(&buf[..]) {
IResult::Done(_, pattern) => {
println!("{}", pattern);
}
e => {
panic!("something went wrong. {:?}", e);
}
}
} else {
println!("please provide a filename");
}
}
#[macro_use]
extern crate nom;
pub mod parser;
mod parser;
mod tests;
pub use parser::parse;
use std::fmt;
#[derive(Debug)]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment