mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
16 lines
341 B
Rust
16 lines
341 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
|
|
.value_of("NAME")
|
|
.expect("default ensures there is always a value")
|
|
);
|
|
}
|