Skip to main content

retch_cli/
cli.rs

1use clap::{Parser, ValueEnum};
2
3/// Command-line arguments for retch.
4#[derive(Parser, Debug)]
5#[command(author, version, about, long_about = None)]
6pub struct Cli {
7    /// Output mode: short, long, or custom
8    #[arg(short, long, default_value = "long")]
9    pub mode: Option<String>,
10
11    /// Use a specific theme
12    #[arg(short, long)]
13    pub theme: Option<String>,
14
15    /// Path to custom config file
16    #[arg(short, long)]
17    pub config: Option<String>,
18
19    /// Disable logo
20    #[arg(long)]
21    pub no_logo: bool,
22
23    /// Show only ASCII logo (even if graphics are supported)
24    #[arg(long)]
25    pub ascii_only: bool,
26
27    /// Short output mode (OS, Kernel, Host, CPU, GPU, Memory, Disk)
28    #[arg(long)]
29    pub short: bool,
30
31    /// Long output mode (show all fields)
32    #[arg(long)]
33    pub long: bool,
34
35    /// List available themes
36    #[arg(long)]
37    pub list_themes: bool,
38
39    /// Print an example custom theme template
40    #[arg(long)]
41    pub print_theme_template: bool,
42
43    /// List known distros
44    #[arg(long)]
45    pub list_distros: bool,
46
47    /// Print logos for known distros
48    #[arg(long)]
49    pub print_logos: bool,
50
51    /// Print default config (commented) to stdout
52    #[arg(long)]
53    pub generate_config: bool,
54
55    /// Write default config to a file (uses default location if no path given)
56    #[arg(long)]
57    pub write_config: bool,
58
59    /// Path(s) to write the config file to. Only the first value is used.
60    #[arg(trailing_var_arg = true, num_args = 0..)]
61    pub write_config_path: Vec<String>,
62
63    /// Merge default settings (as comments) into existing config
64    #[arg(long)]
65    pub merge_config: bool,
66
67    /// Fields to display (comma separated). Overrides config
68    #[arg(long)]
69    pub fields: Option<String>,
70
71    /// Generate shell completions
72    #[arg(long, value_enum)]
73    pub completions: Option<CompletionShell>,
74}
75
76/// Supported shells for completion generation.
77#[derive(ValueEnum, Clone, Debug)]
78pub enum CompletionShell {
79    Bash,
80    Elvish,
81    Fish,
82    #[clap(name = "power-shell")]
83    PowerShell,
84    Zsh,
85    Nushell,
86}