Skip to main content

#
02_apps/
02_apps.rs

    1use clap::{Command, arg};
    2
    3fn 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}