diff options
Diffstat (limited to 'vendor/clap/examples/tutorial_builder/03_02_option.rs')
-rw-r--r-- | vendor/clap/examples/tutorial_builder/03_02_option.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/vendor/clap/examples/tutorial_builder/03_02_option.rs b/vendor/clap/examples/tutorial_builder/03_02_option.rs new file mode 100644 index 000000000..80e2b9159 --- /dev/null +++ b/vendor/clap/examples/tutorial_builder/03_02_option.rs @@ -0,0 +1,11 @@ +// Note: this requires the `cargo` feature + +use clap::{arg, command}; + +fn main() { + let matches = command!() + .arg(arg!(-n --name <NAME>).required(false)) + .get_matches(); + + println!("name: {:?}", matches.get_one::<String>("name")); +} |