diff options
Diffstat (limited to 'vendor/clap/examples/escaped-positional.rs')
-rw-r--r-- | vendor/clap/examples/escaped-positional.rs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/vendor/clap/examples/escaped-positional.rs b/vendor/clap/examples/escaped-positional.rs index a0fff790b..fdcb930fb 100644 --- a/vendor/clap/examples/escaped-positional.rs +++ b/vendor/clap/examples/escaped-positional.rs @@ -1,9 +1,7 @@ -// Note: this requires the `cargo` feature - use clap::{arg, command, value_parser, ArgAction}; fn main() { - let matches = command!() + let matches = command!() // requires `cargo` feature .arg(arg!(eff: -f).action(ArgAction::SetTrue)) .arg( arg!(pea: -p <PEAR>) @@ -22,10 +20,7 @@ fn main() { // This is what will happen with `myprog -f -p=bob -- sloppy slop slop`... // -f used: true - println!( - "-f used: {:?}", - *matches.get_one::<bool>("eff").expect("defaulted by clap") - ); + println!("-f used: {:?}", matches.get_flag("eff")); // -p's value: Some("bob") println!("-p's value: {:?}", matches.get_one::<String>("pea")); // 'slops' values: Some(["sloppy", "slop", "slop"]) |