]>
Commit | Line | Data |
---|---|---|
923072b8 FG |
1 | // Note: this requires the `cargo` feature |
2 | ||
3 | use clap::{command, Arg, ArgAction}; | |
04454e1e FG |
4 | |
5 | fn main() { | |
923072b8 FG |
6 | let matches = command!() |
7 | .arg( | |
8 | Arg::new("verbose") | |
9 | .short('v') | |
10 | .long("verbose") | |
11 | .action(ArgAction::SetTrue), | |
12 | ) | |
13 | .get_matches(); | |
04454e1e | 14 | |
923072b8 FG |
15 | println!( |
16 | "verbose: {:?}", | |
17 | *matches | |
18 | .get_one::<bool>("verbose") | |
19 | .expect("defaulted by clap") | |
20 | ); | |
04454e1e | 21 | } |