2022-03-03 18:32:29 +00:00
|
|
|
// Note: this requires the `cargo` feature
|
|
|
|
|
2022-06-06 19:55:43 +00:00
|
|
|
use clap::{arg, command, AppSettings, ArgAction};
|
2021-11-30 18:30:19 +00:00
|
|
|
|
|
|
|
fn main() {
|
2022-02-15 14:33:38 +00:00
|
|
|
let matches = command!()
|
2021-11-30 18:30:19 +00:00
|
|
|
.global_setting(AppSettings::DeriveDisplayOrder)
|
2022-02-10 17:51:40 +00:00
|
|
|
.allow_negative_numbers(true)
|
2022-06-06 19:55:43 +00:00
|
|
|
.arg(arg!(--two <VALUE>).action(ArgAction::Set))
|
|
|
|
.arg(arg!(--one <VALUE>).action(ArgAction::Set))
|
2021-11-30 18:30:19 +00:00
|
|
|
.get_matches();
|
|
|
|
|
2022-05-23 15:50:11 +00:00
|
|
|
println!(
|
|
|
|
"two: {:?}",
|
2022-05-25 15:46:42 +00:00
|
|
|
matches.get_one::<String>("two").expect("required")
|
2022-05-23 15:50:11 +00:00
|
|
|
);
|
|
|
|
println!(
|
|
|
|
"one: {:?}",
|
2022-05-25 15:46:42 +00:00
|
|
|
matches.get_one::<String>("one").expect("required")
|
2022-05-23 15:50:11 +00:00
|
|
|
);
|
2021-11-30 18:30:19 +00:00
|
|
|
}
|