clap/examples/tutorial_builder/02_app_settings.rs
Ed Page 272f840178 feat: Replace core set of AppSettings with functions
This is a part of #2717

Some settings didn't get getters because
- They are transient parse settings (e.g. ignore errors)
- They get propagated to args and should be checked there

`is_allow_hyphen_values_set` is a curious case.  In some cases, we only
check the app and not an arg.  This seems suspicious.
2022-02-11 12:35:09 -06:00

14 lines
461 B
Rust

use clap::{app_from_crate, arg, AppSettings};
fn main() {
let matches = app_from_crate!()
.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"));
}