1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
//! A simply library for parsing command line arguments when writing
//! command line and console applications.
//!
//!
//! You can use `clap` to lay out a list of possible valid command line arguments and let `clap` parse the string given by the user at runtime.
//! When using `clap` you define a set of parameters and rules for your arguments and at runtime `clap` will determine their validity.
//! Also, `clap` provides the traditional version and help switches 'for free' by parsing the list of possible valid arguments lazily at runtime.
//! i.e. only when it's been determined that the user wants or needs to see the help and version information.
//!
//! After defining a list of possible valid arguments you get a list of matches that the user supplied at runtime. You can then use this list to
//! determine the functioning of your program.
//!
//! Example:
//!
//! ```no_run
//! use clap::{Arg, App};
//!
//! // ...
//!
//! let matches = App::new("MyApp")
//! .version("1.0")
//! .author("Kevin K. <kbknapp@gmail.com>")
//! .about("Does awesome things")
//! .arg(Arg::new("config")
//! .short("c")
//! .long("config")
//! .help("Sets a custom config file")
//! .takes_value(true))
//! .arg(Arg::new("output")
//! .help("Sets an optional output file")
//! .index(1))
//! .arg(Arg::new("debug")
//! .short("d")
//! .multiple(true)
//! .help("Turn debugging information on"))
//! .subcomamnd(SubCommand::new("test")
//! .about("Has test sub functionality")
//! .arg(Arg::new("verbose")
//! .short("v")
//! .help("Display verbose information")))
//! .get_matches();
//!
//! if let Some(o) = matches.value_of("output") {
//! println!("Value for output: {}", o);
//! }
//!
//! if let Some(c) = matches.value_of("config") {
//! println!("Value for config: {}", c);
//! }
//!
//! match matches.occurrences_of("debug") {
//! 0 => println!("Debug mode is off"),
//! 1 => println!("Debug mode is kind of on"),
//! 2 => println!("Debug mode is on"),
//! 3 | _ => println!("Don't be crazy"),
//! }
//!
//! if let Some(ref matches) = matches.subcommand_matches("test") {
//! if matches.is_present("verbose") {
//! println!("Printing verbose test info...");
//! } else {
//! println!("Not printing regular test info...");
//! }
//! }
//!
//! // more porgram logic goes here...
//! ```
//!
//! If you were to compile the above program and run it with the flag `--help` or `-h` the following output woud be presented
//!
//! ```sh
//! $ myprog --help
//! MyApp 1.0
//! Kevin K. <kbknapp@gmail.com>
//! Does awesome things
//!
//! USAGE:
//! MyApp [FLAGS] [OPTIONS] [POSITIONAL] [SUBCOMMANDS]
//!
//! FLAGS:
//! -d Turn debugging information on
//! -h,--help Prints this message
//! -v,--version Prints version information
//!
//! OPTIONS:
//! -c,--config <config> Sets a custom config file
//!
//! POSITIONAL ARGUMENTS:
//! output Sets an optional output file
//!
//! SUBCOMMANDS:
//! help Prints this message
//! test Has test sub-functionality
//! ```
pub use ArgMatches;
pub use Arg;
pub use App;
pub use SubCommand;