use clap::Parser; #[derive(Debug, clap::Parser)] #[command(version, about, long_about = None)] struct Args { /// Directory containing issues. #[arg(short, long)] issues_dir: String, /// Type of behavior/output. #[command(subcommand)] command: Commands, } #[derive(clap::Subcommand, Debug)] enum Commands { /// List issues. List, /// Create a new issue. New { title: Option, description: Option, }, } fn main() -> anyhow::Result<()> { let args: Args = Args::parse(); // println!("{:?}", args); match args.command { Commands::List => { let issues = entomologist::issues::Issues::new_from_dir(std::path::Path::new(&args.issues_dir))?; for (uuid, issue) in issues.issues.iter() { println!("{} {} ({:?})", uuid, issue.title, issue.state); } } Commands::New { title, description } => { println!( "should make a new issue, title={:?}, description={:?}", title, description ); } } Ok(()) }