]> git.proxmox.com Git - rustc.git/blame - 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
923072b8
FG
1// Note: this requires the `cargo` feature
2
3use clap::{command, Arg, ArgAction};
04454e1e
FG
4
5fn 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}