Skip to main content

retch_cli/
cli.rs

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