Skip to main content

retch_cli/
cli.rs

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