1use std::path::PathBuf;
2
3use clap::{Parser, Subcommand, ValueEnum};
4
5#[derive(Debug, Clone, ValueEnum)]
6pub enum OutputFormat {
7 Table,
8 Json,
9 Csv,
10}
11
12#[derive(Debug, Clone, ValueEnum)]
13pub enum SortMetric {
14 Cognitive,
15 Cyclomatic,
16 Sloc,
17 Name,
18}
19
20#[derive(Debug, Parser)]
21#[command(
22 name = "arborist",
23 version,
24 about = "Code complexity metrics powered by arborist-metrics"
25)]
26pub struct Cli {
27 #[command(subcommand)]
28 pub command: Option<Command>,
29
30 #[command(flatten)]
31 pub analyze: AnalyzeArgs,
32}
33
34#[derive(Debug, Subcommand)]
35pub enum Command {
36 About,
38 Update {
40 #[arg(long)]
42 check: bool,
43 },
44}
45
46#[derive(Debug, clap::Args)]
47pub struct AnalyzeArgs {
48 #[arg()]
50 pub paths: Vec<PathBuf>,
51
52 #[arg(long, default_value = "table")]
54 pub format: OutputFormat,
55
56 #[arg(long)]
58 pub language: Option<String>,
59
60 #[arg(long)]
62 pub threshold: Option<u64>,
63
64 #[arg(long)]
66 pub exceeds_only: bool,
67
68 #[arg(long)]
70 pub sort: Option<SortMetric>,
71
72 #[arg(long)]
74 pub top: Option<usize>,
75
76 #[arg(long, value_delimiter = ',')]
78 pub languages: Option<Vec<String>>,
79
80 #[arg(long)]
82 pub gitignore: bool,
83
84 #[arg(long)]
86 pub no_methods: bool,
87}