clap/examples/tutorial_builder/03_05_default_values.rs

17 lines
341 B
Rust
Raw Normal View History

// Note: this requires the `cargo` feature
2022-02-15 14:33:38 +00:00
use clap::{arg, command};
fn main() {
2022-02-15 14:33:38 +00:00
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")
);
}