]> git.proxmox.com Git - rustc.git/blame_incremental - vendor/clap/examples/tutorial_builder/03_01_flag_bool.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / vendor / clap / examples / tutorial_builder / 03_01_flag_bool.rs
... / ...
CommitLineData
1// Note: this requires the `cargo` feature
2
3use clap::{command, Arg, ArgAction};
4
5fn main() {
6 let matches = command!()
7 .arg(
8 Arg::new("verbose")
9 .short('v')
10 .long("verbose")
11 .action(ArgAction::SetTrue),
12 )
13 .get_matches();
14
15 println!(
16 "verbose: {:?}",
17 *matches
18 .get_one::<bool>("verbose")
19 .expect("defaulted by clap")
20 );
21}