use clap::{Parser, Subcommand}; use std::path::PathBuf; pub mod state; #[derive(Parser)] #[command(author, version, about, long_about = None)] struct Cli { /// Sets a custom config file #[arg(short, long, value_name = "FILE")] config: Option, /// Turn debugging information on #[arg(short, long, action = clap::ArgAction::Count)] debug: u8, #[command(subcommand)] command: Option, } #[derive(Subcommand)] enum Commands { /// does testing things Test { /// lists test values #[arg(short, long)] list: bool, }, } fn main() { let cli = Cli::parse(); // You can check for the existence of subcommands, and if found use their // matches just as you would the top level cmd match &cli.command { Some(Commands::Test { list }) => { if *list { println!("Printing testing lists..."); } else { println!("Not printing testing lists..."); } } None => { println!("Hello, world!!!!"); } } }