mirror of
https://github.com/clap-rs/clap
synced 2024-12-16 07:42:32 +00:00
21 lines
456 B
Rust
21 lines
456 B
Rust
// 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")
|
|
);
|
|
}
|