blob: 41ecbb1d73f146fadf3723e7ca3921d360f9e304 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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")
);
}
|