1 | use clap::{arg, command, ArgAction}; |
---|---|
2 | |
3 | fn main() { |
4 | let matches = command!() // requires `cargo` feature |
5 | .next_line_help(true) |
6 | .arg(arg!(--two <VALUE>).required(true).action(ArgAction::Set)) |
7 | .arg(arg!(--one <VALUE>).required(true).action(ArgAction::Set)) |
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 |