use clap::{Parser, Subcommand};
#[derive(Parser, Debug)]
#[command(name = "cargo")]
#[command(bin_name = "cargo")]
pub struct CargoCli {
#[command(subcommand)]
pub command: CargoSubcommand,
}
#[derive(Subcommand, Debug)]
pub enum CargoSubcommand {
#[command(name = "test-filter")]
TestFilter(TestFilterArgs),
}
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
pub struct TestFilterArgs {
#[arg(long, conflicts_with = "unit")]
pub integration: bool,
#[arg(long, conflicts_with = "integration")]
pub unit: bool,
#[arg(long, value_delimiter = ',')]
pub tag: Vec<String>,
#[arg(long, value_delimiter = ',')]
pub exclude_tag: Vec<String>,
#[arg(long)]
pub name: Option<String>,
#[arg(long)]
pub path: Option<String>,
#[arg(long)]
pub timeout: Option<u64>,
#[arg(long)]
pub list: bool,
#[arg(short, long)]
pub verbose: bool,
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
pub test_args: Vec<String>,
}
impl TestFilterArgs {
pub fn has_filters(&self) -> bool {
self.integration
|| self.unit
|| !self.tag.is_empty()
|| !self.exclude_tag.is_empty()
|| self.name.is_some()
|| self.path.is_some()
}
}