aboutsummaryrefslogtreecommitdiff
path: root/src/arguments.rs
blob: 24697d903b934120459ae496469d8f9077f19fe7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
use clap::{Parser,Subcommand,Args};
use std::path::PathBuf;

#[derive(Parser)]
pub struct Cli {
    #[command(subcommand)]
    pub command: Commands,

    /// Configuration file location
    #[arg(short, long)]
    pub config: Option<PathBuf>,
}

#[derive(Subcommand)]
pub enum Commands {
    /// Add or update config from list
    Modify(ModifyArgs),

    /// Remove program from list
    Remove(RemoveArgs),

    /// Print list of tracked configs
    List {},

    /// Update a config
    Sync(SyncArgs),
}

#[derive(Args)]
pub struct ModifyArgs {
    /// Name of program
    pub name: String,

    /// Parent directory on system config resides in
    pub dest: PathBuf,

    /// File(s) in configs directory
    pub file: PathBuf,
}

#[derive(Args)]
pub struct RemoveArgs {
    /// Name of program
    pub name: String,
}

#[derive(Args)]
pub struct SyncArgs {
    /// Names of programs to update
    pub names: Vec<String>,

    /// Sync all programs
    #[arg(short, long)]
    pub all: bool,

    /// Never prompt to skip
    #[arg(short, long)]
    pub force: bool,
}