clap/examples/02_Apps.rs
2015-03-20 12:47:28 -04:00

29 lines
1.2 KiB
Rust

extern crate clap;
use clap::{App};
fn main() {
// Apps describe the top level application
//
// You create an App and set various options on that App using the "builder pattern"
//
// The options (version(), author(), about()) aren't mandatory, but recommended. There is
// another option, usage(), which is an exception to the rule. This should only be used when
// the default usage string automatically generated by clap doesn't suffice.
//
// You also set all the valid arguments your App should accept via the arg() and args() (a
// well as subcommands via the subcommand() and subcommands() methods) which will be covered
// later.
//
// Once all options have been set, call .get_matches() in order to find all valid command line
// arguments that supplied by the user at runtime. The name given to new() will be displayed
// when the version or help flags are used.
let matches = App::new("MyApp")
.version("1.0")
.author("Kevin K. <kbknapp@gmail.com>")
.about("Does awesome things")
.get_matches();
// Continued program logic goes here...
}