| 1 | use clap::{arg, command}; |
|---|---|
| 2 | |
| 3 | fn main() { |
| 4 | // requires `cargo` feature, reading name, version, author, and description from `Cargo.toml` |
| 5 | let matches = command!() |
| 6 | .arg(arg!(--two <VALUE>).required(true)) |
| 7 | .arg(arg!(--one <VALUE>).required(true)) |
| 8 | .get_matches(); |
| 9 | |
| 10 | println!( |
| 11 | "two: {:?}", |
| 12 | matches.get_one::<String>("two").expect( "required") |
| 13 | ); |
| 14 | println!( |
| 15 | "one: {:?}", |
| 16 | matches.get_one::<String>("one").expect( "required") |
| 17 | ); |
| 18 | } |
| 19 |
