aboutsummaryrefslogtreecommitdiff
path: root/3.2.23/examples/tutorial_builder/03_01_flag_bool.rs
blob: 03f2f1756f6bed6f52d41ce28df689986e942eeb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use clap::{command, Arg, ArgAction};

fn main() {
    let matches = command!() // requires `cargo` feature
        .arg(
            Arg::new("verbose")
                .short('v')
                .long("verbose")
                .action(ArgAction::SetTrue),
        )
        .get_matches();

    println!("verbose: {:?}", matches.get_flag("verbose"));
}