2021-12-07 21:34:23 +00:00
|
|
|
use clap::Parser;
|
|
|
|
|
|
|
|
/// Simple program to greet a person
|
|
|
|
#[derive(Parser, Debug)]
|
2024-01-17 14:06:56 +00:00
|
|
|
#[command(version, about, long_about = None)]
|
2021-12-07 21:34:23 +00:00
|
|
|
struct Args {
|
|
|
|
/// Name of the person to greet
|
2022-09-02 20:37:23 +00:00
|
|
|
#[arg(short, long)]
|
2021-12-07 21:34:23 +00:00
|
|
|
name: String,
|
|
|
|
|
|
|
|
/// Number of times to greet
|
2022-09-02 20:37:23 +00:00
|
|
|
#[arg(short, long, default_value_t = 1)]
|
2021-12-07 21:34:23 +00:00
|
|
|
count: u8,
|
2021-12-01 20:30:51 +00:00
|
|
|
}
|
|
|
|
|
2021-11-30 03:05:42 +00:00
|
|
|
fn main() {
|
2021-12-07 21:34:23 +00:00
|
|
|
let args = Args::parse();
|
2021-11-30 03:05:42 +00:00
|
|
|
|
2021-12-07 21:34:23 +00:00
|
|
|
for _ in 0..args.count {
|
2024-05-04 19:59:40 +00:00
|
|
|
println!("Hello {}!", args.name);
|
2021-12-01 20:30:51 +00:00
|
|
|
}
|
2021-11-30 03:05:42 +00:00
|
|
|
}
|