use clap::{ArgGroup, Args, Parser, Subcommand};
#[derive(Parser, Debug)]
#[command(
author,
version,
about,
subcommand_required = true,
arg_required_else_help = true
)]
pub struct Cli {
#[command(subcommand)]
pub command: Command,
}
#[derive(Subcommand, Debug)]
pub enum Command {
#[command(alias = "s")]
Standings(StandingsArgs),
#[command(alias = "r")]
Results(ResultsArgs),
#[command(alias = "d")]
Driver(DriverArgs),
}
#[derive(Debug, Args)]
#[command(
group(
ArgGroup::new("standings").args(["drivers", "constructors"]).required(true).multiple(false)
)
)]
pub struct StandingsArgs {
#[arg(short = 'd', long = "drivers")]
pub drivers: bool,
#[arg(short = 'c', long = "constructors")]
pub constructors: bool,
#[arg(short = 's', long = "season", default_value = "current")]
pub season: String,
}
#[derive(Debug, Args)]
pub struct ResultsArgs {
#[arg(short = 's', long = "season", default_value = "current")]
pub season: String,
#[arg(short = 'r', long = "round", default_value = "last")]
pub round: String,
}
#[derive(Debug, Args)]
pub struct DriverArgs {
#[arg(short = 's', long = "season", default_value = "current")]
pub season: String,
#[arg(short = 'n', long = "name", value_delimiter = ',', num_args = 1..)]
pub name: Vec<String>,
}