Skip to main content

#
02_crate_derive/
02_crate.rs

    1use clap::Parser;
    2
    3#[derive(Parser)]
    4#[command(version, about, long_about = None)] // Read from `Cargo.toml`
    5struct Cli {
    6    #[arg(long)]
    7    two: String,
    8    #[arg(long)]
    9    one: String,
    10}
    11
    12fn main() {
    13    let cli = Cli::parse();
    14
    15    println!("two: {:?}", cli.two);
    16    println!("one: {:?}", cli.one);
    17}