clap/examples/tutorial_builder/02_app_settings.rs

17 lines
491 B
Rust
Raw Normal View History

// Note: this requires the `cargo` feature
2022-02-15 14:33:38 +00:00
use clap::{arg, command, AppSettings};
fn main() {
2022-02-15 14:33:38 +00:00
let matches = command!()
.args_override_self(true)
.global_setting(AppSettings::DeriveDisplayOrder)
.allow_negative_numbers(true)
.arg(arg!(--two <VALUE>))
.arg(arg!(--one <VALUE>))
.get_matches();
println!("two: {:?}", matches.value_of("two").expect("required"));
println!("one: {:?}", matches.value_of("one").expect("required"));
}