clap/examples/tutorial_builder/02_crate.rs

20 lines
411 B
Rust
Raw Normal View History

// Note: this requires the `cargo` feature
2022-02-15 14:33:38 +00:00
use clap::{arg, command};
fn main() {
2022-02-15 14:33:38 +00:00
let matches = command!()
.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
);
}