mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 14:52:33 +00:00
17 lines
392 B
Rust
17 lines
392 B
Rust
// Note: this requires the `cargo` feature
|
|
|
|
use clap::{arg, command};
|
|
|
|
fn main() {
|
|
let matches = command!()
|
|
.arg(arg!([NAME]).default_value("alice"))
|
|
.get_matches();
|
|
|
|
println!(
|
|
"NAME: {:?}",
|
|
matches
|
|
.get_one::<String>("NAME")
|
|
.expect("matches definition")
|
|
.expect("default ensures there is always a value")
|
|
);
|
|
}
|