summaryrefslogtreecommitdiffstats
path: root/vendor/clap/examples/tutorial_builder/03_02_option.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/clap/examples/tutorial_builder/03_02_option.rs')
-rw-r--r--vendor/clap/examples/tutorial_builder/03_02_option.rs9
1 files changed, 9 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..e9ba3e41a
--- /dev/null
+++ b/vendor/clap/examples/tutorial_builder/03_02_option.rs
@@ -0,0 +1,9 @@
+use clap::{command, Arg};
+
+fn main() {
+ let matches = command!() // requires `cargo` feature
+ .arg(Arg::new("name").short('n').long("name"))
+ .get_matches();
+
+ println!("name: {:?}", matches.get_one::<String>("name"));
+}