clap/examples/tutorial_builder/02_apps.rs

21 lines
488 B
Rust
Raw Normal View History

2022-02-12 03:48:29 +00:00
use clap::{arg, Command};
fn main() {
2022-02-12 03:48:29 +00:00
let matches = Command::new("MyApp")
.version("1.0")
.author("Kevin K. <kbknapp@gmail.com>")
.about("Does awesome things")
.arg(arg!(--two <VALUE>))
.arg(arg!(--one <VALUE>))
.get_matches();
2022-05-23 15:50:11 +00:00
println!(
"two: {:?}",
matches.get_one::<String>("two").expect("required")
2022-05-23 15:50:11 +00:00
);
println!(
"one: {:?}",
matches.get_one::<String>("one").expect("required")
2022-05-23 15:50:11 +00:00
);
}