]> git.proxmox.com Git - rustc.git/blob - vendor/clap-3.2.20/examples/tutorial_builder/02_app_settings.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / vendor / clap-3.2.20 / examples / tutorial_builder / 02_app_settings.rs
1 use clap::{arg, command, AppSettings, ArgAction};
2
3 fn main() {
4 let matches = command!() // requires `cargo` feature
5 .global_setting(AppSettings::DeriveDisplayOrder)
6 .allow_negative_numbers(true)
7 .arg(arg!(--two <VALUE>).action(ArgAction::Set))
8 .arg(arg!(--one <VALUE>).action(ArgAction::Set))
9 .get_matches();
10
11 println!(
12 "two: {:?}",
13 matches.get_one::<String>("two").expect("required")
14 );
15 println!(
16 "one: {:?}",
17 matches.get_one::<String>("one").expect("required")
18 );
19 }