A small BSD-style getopt implementation in Rust.
- Short options (
-a,-b value) - Grouped options (
-abc) - Option arguments (
-ovalueor-o value) --terminator
use bsd_getopt::Getopt;
let args = vec![
"prog".to_string(),
"-a".to_string(),
"-bfoo".to_string(),
];
let mut g = Getopt::new("ab:", args);
while let Some(opt) = g.next() {
println!("opt: {}, arg: {:?}", opt, g.optarg);
}