feat(main): add CLI argument parsing with clap derive
Swadhin Biswas committed 7 months ago
9b05da2
1 parent 5ea50d8
commit 9b05da2
1 file changed
+40 -3
Showing 1 changed file+40-3
▼src/main.rs
+40-3
| @@ -1,3 +1,40 @@ | ||
1 | -fn main() { | |
2 | - println!("Hello, FetchX!"); | |
3 | -} | |
1 | +//! FetchX - A fast, feature-rich system information tool written in Rust. | |
2 | +//! | |
3 | +//! An exact clone of neofetch with extra features: emoji support, image display, | |
4 | +//! Nerd Font icons, and blazing fast performance. | |
5 | + | |
6 | +mod ascii; | |
7 | +mod colors; | |
8 | +mod config; | |
9 | +mod display; | |
10 | +mod image_backend; | |
11 | +mod image_cache; | |
12 | +mod system; | |
13 | +mod utils; | |
14 | + | |
15 | +use clap::Parser; | |
16 | +use config::Config; | |
17 | +use display::Display; | |
18 | +use system::SystemInfo; | |
19 | + | |
20 | +/// FetchX - Fast system information tool with emoji & image support | |
21 | +#[derive(Parser, Debug)] | |
22 | +#[command(name = "fetchx")] | |
23 | +#[command(author = "FetchX Contributors")] | |
24 | +#[command(version = "0.2.0")] | |
25 | +#[command(about = "A fast, modern system information tool — neofetch clone in Rust", long_about = None)] | |
26 | +struct Args { | |
27 | + /// Disable colors in output | |
28 | + #[arg(long)] | |
29 | + no_color: bool, | |
30 | + | |
31 | + /// Enable/disable bold text | |
32 | + #[arg(long)] | |
33 | + bold: Option<bool>, | |
34 | + | |
35 | + /// Image backend: ascii, kitty, sixel, chafa, off | |
36 | + #[arg(short, long, value_name = "BACKEND")] | |
37 | + backend: Option<String>, | |
38 | + | |
39 | + /// Image source: auto, ascii, wallpaper, or /path/to/image | |
40 | + #[arg(short, long, value_name = "SOURCE")] | |
4 | 41 | |