collect_args

Crates.iocollect_args
lib.rscollect_args
version0.0.2
sourcesrc
created_at2024-07-14 16:35:43.336743
updated_at2024-07-14 16:55:55.948194
descriptionParses env args
homepagehttps://github.com/seacrst/collect_args
repository
max_upload_size
id1303119
size7,106
Seacrest (seacrst)

documentation

README

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");
Commit count: 0

cargo fmt