diff options
Diffstat (limited to 'vendor/clap/examples/tutorial_builder/03_01_flag_bool.rs')
-rw-r--r-- | vendor/clap/examples/tutorial_builder/03_01_flag_bool.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/vendor/clap/examples/tutorial_builder/03_01_flag_bool.rs b/vendor/clap/examples/tutorial_builder/03_01_flag_bool.rs new file mode 100644 index 000000000..41ecbb1d7 --- /dev/null +++ b/vendor/clap/examples/tutorial_builder/03_01_flag_bool.rs @@ -0,0 +1,21 @@ +// Note: this requires the `cargo` feature + +use clap::{command, Arg, ArgAction}; + +fn main() { + let matches = command!() + .arg( + Arg::new("verbose") + .short('v') + .long("verbose") + .action(ArgAction::SetTrue), + ) + .get_matches(); + + println!( + "verbose: {:?}", + *matches + .get_one::<bool>("verbose") + .expect("defaulted by clap") + ); +} |