1use std::path::PathBuf;
4
5use clap::{Args, Parser, Subcommand, ValueEnum};
6
7#[derive(Parser, Debug)]
9#[command(name = "loq", version, about = "Enforce file size constraints")]
10pub struct Cli {
11 #[command(subcommand)]
13 pub command: Option<Command>,
14
15 #[arg(short = 'v', long = "verbose", global = true)]
17 pub verbose: bool,
18}
19
20#[derive(Subcommand, Debug, Clone)]
22pub enum Command {
23 Check(CheckArgs),
25 Init(InitArgs),
27 Baseline(BaselineArgs),
29 Relax(RelaxArgs),
31}
32
33#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, ValueEnum)]
35pub enum OutputFormat {
36 #[default]
38 Text,
39 Json,
41}
42
43#[derive(Args, Debug, Clone)]
45pub struct CheckArgs {
46 #[arg(value_name = "PATH", allow_hyphen_values = true)]
48 pub paths: Vec<PathBuf>,
49
50 #[arg(long = "no-cache")]
52 pub no_cache: bool,
53
54 #[arg(long = "output-format", value_enum, default_value_t = OutputFormat::Text)]
56 pub output_format: OutputFormat,
57}
58
59#[derive(Args, Debug, Clone)]
61pub struct InitArgs {}
62
63#[derive(Args, Debug, Clone)]
65pub struct BaselineArgs {
66 #[arg(long = "threshold")]
68 pub threshold: Option<usize>,
69
70 #[arg(long = "allow-growth")]
72 pub allow_growth: bool,
73}
74
75#[derive(Args, Debug, Clone)]
77pub struct RelaxArgs {
78 #[arg(value_name = "FILE")]
80 pub files: Vec<PathBuf>,
81
82 #[arg(long = "buffer", default_value_t = 100)]
84 pub buffer: usize,
85}