collect_args 0.0.2

Parses env args
Documentation
  • Coverage
  • 75%
    6 out of 8 items documented4 out of 6 items with examples
  • Size
  • Source code size: 6.79 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.36 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • seacrst

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");