Skip to main content

#
demo/
demo.rs

    1use clap::Parser;
    2
    3/// Simple program to greet a person
    4#[derive(Parser, Debug)]
    5#[command(version, about, long_about = None)]
    6struct Args {
    7    /// Name of the person to greet
    8    #[arg(short, long)]
    9    name: String,
    10
    11    /// Number of times to greet
    12    #[arg(short, long, default_value_t = 1)]
    13    count: u8,
    14}
    15
    16fn main() {
    17    let args = Args::parse();
    18
    19    for _ in 0..args.count {
    20        println!("Hello {}!", args.name);
    21    }
    22}