use clap::{ arg, crate_authors, crate_description, crate_name, crate_version, Arg, ArgAction, Command, }; pub fn cli() -> Command { Command::new(crate_name!()) .about(crate_description!()) .author(crate_authors!()) .version(crate_version!()) .subcommand_required(true) .arg_required_else_help(true) .allow_external_subcommands(true) .subcommand( Command::new("random") .about("Generates a random something") .args_conflicts_with_subcommands(true) .subcommand( Command::new("henchman") .about("Generates a random henchman") .arg( Arg::new("csv") .long("csv") .action(ArgAction::SetTrue) .help("Output in CSV format"), ), ) .subcommand(Command::new("magic").about("Generates a magic item")), ) .subcommand( Command::new("roll") .about("Rolls dice based on a given formula") .arg(arg!( "The dice rolling formula")) .arg_required_else_help(true), ) .subcommand( Command::new("table") .about("Rolls on a random table") .arg(arg!( "The name of the table to roll on")) .arg_required_else_help(true), ) }