2 releases

0.0.2 Jul 14, 2024
0.0.1 Jul 14, 2024

#14 in #collect

MIT license

7KB
96 lines

Collect Args

let args = Args::collect();
let bar = args.input("foo").1.expect("Following value is required");
let (kek, is_kek) = args.flag("kek");
let opts = args.options(&["bar", "baz"]);

match opts.unwrap_or(String::from("nothing")) {
  String::from("bar") => todo!()
  String::from("baz") => todo!()
  _ => todo!()
}

let (sel_key, opt) = args.select("sel_key", &["opt1", "opt2", "opt3"]);
let opt_value = opr.expect("Please enter {sel_key} option");

No runtime deps