nydus icon indicating copy to clipboard operation
nydus copied to clipboard

upgrade to use clap 3.0.14

Open liubogithub opened this issue 3 years ago • 1 comments

clap now offers a neater derive API, which can help us save hundreds of LOC in nydusd, nydus-image, etc.

use clap::Parser;

/// Simple program to greet a person
#[derive(Parser, Debug)]
#[clap(author, version, about, long_about = None)]
struct Args {
    /// Name of the person to greet
    #[clap(short, long)]
    name: String,

    /// Number of times to greet
    #[clap(short, long, default_value_t = 1)]
    count: u8,
}

fn main() {
    let args = Args::parse();

    for _ in 0..args.count {
        println!("Hello {}!", args.name)
    }
}

liubogithub avatar Feb 09 '22 19:02 liubogithub

I will work on it

uran0sH avatar Jun 01 '22 05:06 uran0sH