Skip to content

Commit 8a70017

Browse files
authored
Merge pull request #154 from xscriptor/update/modularize-xfetch
update/modularize xfetch
2 parents 142fde2 + 76df637 commit 8a70017

18 files changed

Lines changed: 1136 additions & 1025 deletions

src/cli.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
use clap::{Parser, Subcommand};
2+
3+
#[derive(Parser, Debug)]
4+
#[command(
5+
author,
6+
version,
7+
about,
8+
long_about = None,
9+
after_help = "Examples:\n xfetch\n xfetch --config ~/.config/xfetch/config.jsonc\n xfetch --gen-config\n xfetch plugin install ./plugins/animate-logo\n xfetch plugin list\n xfetch plugin remove animate-logo"
10+
)]
11+
pub struct Cli {
12+
#[command(subcommand)]
13+
pub command: Option<Commands>,
14+
15+
#[arg(short, long, global = true)]
16+
pub config: Option<String>,
17+
18+
#[arg(long, global = true)]
19+
pub gen_config: bool,
20+
}
21+
22+
#[derive(Subcommand, Debug)]
23+
pub enum Commands {
24+
Plugin {
25+
#[command(subcommand)]
26+
action: PluginCommands,
27+
},
28+
}
29+
30+
#[derive(Subcommand, Debug)]
31+
pub enum PluginCommands {
32+
Install {
33+
path: String,
34+
#[arg(long, short)]
35+
repo: Option<String>,
36+
},
37+
List,
38+
Remove {
39+
name: String,
40+
},
41+
}

0 commit comments

Comments
 (0)