use std::path::PathBuf;
use clap::{Parser, Subcommand, ValueEnum};
#[derive(Debug, Clone, ValueEnum)]
pub enum OutputFormat {
Table,
Json,
Csv,
}
#[derive(Debug, Clone, ValueEnum)]
pub enum SortMetric {
Cognitive,
Cyclomatic,
Sloc,
Name,
}
#[derive(Debug, Parser)]
#[command(
name = "arborist",
version,
about = "Code complexity metrics powered by arborist-metrics"
)]
pub struct Cli {
#[command(subcommand)]
pub command: Option<Command>,
#[command(flatten)]
pub analyze: AnalyzeArgs,
}
#[derive(Debug, Subcommand)]
pub enum Command {
About,
Update {
#[arg(long)]
check: bool,
},
}
#[derive(Debug, clap::Args)]
pub struct AnalyzeArgs {
#[arg()]
pub paths: Vec<PathBuf>,
#[arg(long, default_value = "table")]
pub format: OutputFormat,
#[arg(long)]
pub language: Option<String>,
#[arg(long)]
pub threshold: Option<u64>,
#[arg(long)]
pub exceeds_only: bool,
#[arg(long)]
pub sort: Option<SortMetric>,
#[arg(long)]
pub top: Option<usize>,
#[arg(long, value_delimiter = ',')]
pub languages: Option<Vec<String>>,
#[arg(long)]
pub gitignore: bool,
#[arg(long)]
pub no_methods: bool,
}