use clap::Parser; use std::{env, thread, time::Duration}; #[derive(Debug, Parser)] #[command(author, version, about, long_about = None)] struct Args { #[arg(long, short)] message: String, #[arg(long, short, default_value_t = 10)] wait: u8, } fn main() { let Args { message, wait } = Args::parse(); let name = env::var("MY_NAME").unwrap_or(String::from("world")); println!("Hello, {name}!"); println!("Message: {message}"); println!("Will wait for {wait} seconds"); thread::sleep(Duration::from_secs(wait as u64)); }