diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:11:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:12:43 +0000 |
commit | cf94bdc0742c13e2a0cac864c478b8626b266e1b (patch) | |
tree | 044670aa50cc5e2b4229aa0b6b3df6676730c0a6 /vendor/clap/examples/escaped-positional.rs | |
parent | Adding debian version 1.65.0+dfsg1-2. (diff) | |
download | rustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.tar.xz rustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.zip |
Merging upstream version 1.66.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/clap/examples/escaped-positional.rs')
-rw-r--r-- | vendor/clap/examples/escaped-positional.rs | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/vendor/clap/examples/escaped-positional.rs b/vendor/clap/examples/escaped-positional.rs deleted file mode 100644 index fdcb930fb..000000000 --- a/vendor/clap/examples/escaped-positional.rs +++ /dev/null @@ -1,36 +0,0 @@ -use clap::{arg, command, value_parser, ArgAction}; - -fn main() { - let matches = command!() // requires `cargo` feature - .arg(arg!(eff: -f).action(ArgAction::SetTrue)) - .arg( - arg!(pea: -p <PEAR>) - .required(false) - .value_parser(value_parser!(String)), - ) - .arg( - // Indicates that `slop` is only accessible after `--`. - arg!(slop: [SLOP]) - .multiple_values(true) - .last(true) - .value_parser(value_parser!(String)), - ) - .get_matches(); - - // This is what will happen with `myprog -f -p=bob -- sloppy slop slop`... - - // -f used: true - 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"]) - println!( - "'slops' values: {:?}", - matches - .get_many::<String>("slop") - .map(|vals| vals.collect::<Vec<_>>()) - .unwrap_or_default() - ); - - // Continued program logic goes here... -} |