rust-cli-skeleton / src/main.rs

raw file 408 bytes
use clap::Parser;

#[derive(Parser)]
#[command(name = "app", version, about = "CHANGE ME")]
struct Cli {
    #[command(subcommand)]
    cmd: Cmd,
}

#[derive(clap::Subcommand)]
enum Cmd {
    /// do the thing
    Do {
        name: String,
    },
}

fn main() {
    let cli = Cli::parse();
    match cli.cmd {
        Cmd::Do { name } => {
            println!("did the thing for {name}");
        }
    }
}