use getargs::{Opt, Options};
fn main() {
let args = argv::iter().skip(1).map(|os| {
os.to_str()
.expect("argument couldn't be converted to UTF-8")
});
let mut opts = Options::new(args);
while let Some(opt) = opts.next_opt().expect("calling Options::next") {
match opt {
Opt::Short('v') | Opt::Long("value") => eprintln!("'{}': {:?}", opt, opts.value()),
Opt::Short('o') | Opt::Long("opt") => eprintln!("'{}': {:?}", opt, opts.value_opt()),
_ => eprintln!("'{}'", opt),
}
}
for positional in opts.positionals() {
eprintln!("positional argument: {}", positional);
}
}