Packages
·
v0.0.13
clap
Command-line argument parsing with a fluent builder. Build an App, attach Args, and read a typed ArgMatches back.
import "clap/clap" as clap;
let app = clap::App::new("mytool")
.version("0.1.0")
.arg(clap::Arg::new("verbose").short("v").long("verbose").flag());
let m = app.get_matches_from(argv);
if m.is_present("verbose") { /* ... */ }
Long options accept both --name value and --name=value; short flags accept the combined -abc form. get_matches_from(args: Vec[str]) is the cross-platform entry point. ArgMatches exposes typed accessors: is_present(name), value_of(name) -> Option[str], positional_count(), and positional_at(i).