use clap::{Parser, Subcommand, ValueEnum};
use repopilot::output::OutputFormat;
use std::path::PathBuf;
#[derive(Parser)]
#[command(name = "repopilot")]
#[command(about = "Local-first codebase audit CLI", long_about = None)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
Compare {
before: std::path::PathBuf,
after: std::path::PathBuf,
#[arg(long, value_enum, default_value = "console")]
format: CompareOutputFormatArg,
#[arg(short, long)]
output: Option<std::path::PathBuf>,
},
Scan {
path: PathBuf,
#[arg(long, value_enum, default_value = "console")]
format: OutputFormatArg,
#[arg(short, long)]
output: Option<PathBuf>,
#[arg(long)]
max_file_loc: Option<usize>,
#[arg(long)]
max_directory_modules: Option<usize>,
#[arg(long)]
max_directory_depth: Option<usize>,
},
}
#[derive(Clone, Copy, Debug, ValueEnum)]
pub enum OutputFormatArg {
Console,
Html,
Json,
Markdown,
}
#[derive(Clone, Copy, Debug, ValueEnum)]
pub enum CompareOutputFormatArg {
Console,
Json,
Markdown,
}
impl From<OutputFormatArg> for OutputFormat {
fn from(format: OutputFormatArg) -> Self {
match format {
OutputFormatArg::Console => OutputFormat::Console,
OutputFormatArg::Html => OutputFormat::Html,
OutputFormatArg::Json => OutputFormat::Json,
OutputFormatArg::Markdown => OutputFormat::Markdown,
}
}
}