mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 14:52:33 +00:00
16 lines
332 B
Rust
16 lines
332 B
Rust
// 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")
|
|
.expect("matches definition")
|
|
);
|
|
}
|