debian/missing-sources/clap/examples/tutorial_builder/02_apps.rs
raw| 1 | use clap::{arg, Command}; |
| 2 | |
| 3 | fn main() { |
| 4 | let matches = Command::new("MyApp") |
| 5 | .version("1.0") |
| 6 | .about("Does awesome things") |
| 7 | .arg(arg!(--two <VALUE>).required(true)) |
| 8 | .arg(arg!(--one <VALUE>).required(true)) |
| 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 | } |