pirate/tests/main.rs

27 lines
543 B
Rust
Raw Normal View History

2015-04-28 01:10:37 -04:00
extern crate pirate;
2015-06-10 18:14:11 +00:00
use pirate::{Matches, usage, Vars};
2015-04-28 01:10:37 -04:00
fn main() {
let opts = vec!["n:", "b/boop", ":input"];
2015-06-10 18:14:11 +00:00
let mut vars = match Vars::new(&opts) {
Ok(v) => v,
Err(why) => {
println!("{}", why);
2015-04-28 01:10:37 -04:00
return;
2015-06-10 18:14:11 +00:00
}
2015-04-28 01:10:37 -04:00
};
2015-06-10 18:14:11 +00:00
let matches = match Matches::new(&mut vars) {
Ok(m) => m,
Err(why) => {
println!("{}", why);
return;
}
2015-04-28 01:10:37 -04:00
};
2015-06-10 18:14:11 +00:00
if matches.has_arg("-h") || matches.has_arg("--help") {
usage(&vars);
return;
2015-04-28 01:10:37 -04:00
}
}