~nicohman/raven

ref: 0589a29c0e940c1a3993a0756d25f7f8e8922ceb raven/src/args.rs -rw-r--r-- 3.0 KiB
0589a29c — nicohman Restructure args into a struct for better verbose flag usage 2 years ago
                                                                                
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#[derive(StructOpt, Debug)]
#[structopt(name = "raven")]
pub struct Raven {
    #[structopt(flatten)]
    pub verbose: clap_verbosity_flag::Verbosity,
    #[structopt(subcommand)]
    pub command: Command,
}
#[derive(StructOpt, Debug)]
pub enum Command {
    #[structopt(name = "load", about = "Load a complete theme")]
    Load { theme: String },
    #[structopt(name = "new", about = "Create a new theme")]
    New { name: String },
    #[structopt(
        name = "modify",
        about = "Open the currently edited themes's option in $EDITOR"
    )]
    Modify {
        /// Use custom editor
        #[structopt(short = "e", long = "editor")]
        editor: Option<String>,
        name: String,
    },
    #[structopt(name = "delete", about = "Delete a theme")]
    Delete { name: String },
    #[structopt(
        name = "info",
        about = "Print info about the theme being currently edited"
    )]
    Info,
    #[structopt(name = "refresh", about = "Load last loaded theme")]
    Refresh,
    #[structopt(name = "install", about = "Install a theme from ThemeHub repo")]
    Install {
        name: String,
        /// Don't prompt for confirmation
        #[structopt(short = "f", long = "force")]
        force: bool,
    },
    #[structopt(name = "add", about = "Add option to current theme")]
    Add { option: String, name: String },
    #[structopt(name = "rm", about = "Remove an option from edited theme")]
    Rm { name: String },
    #[structopt(name = "key", about = "Add a key-value option")]
    Key { key: String, value: String },
    #[structopt(name = "edit", about = "Edit theme")]
    Edit { name: String },
    #[structopt(name = "menu", about = "Show theme menu")]
    Menu,
    #[structopt(name = "manage", about = "Manage online themes")]
    ManageO(Manage),
    #[structopt(name = "cycle", about = "Control cycle daemon")]
    CycleD(Cycle),
}
#[derive(StructOpt, Debug)]
pub enum Manage {
    #[structopt(name = "export", about = "Export a theme to a tarball")]
    Export { name: String },
    #[structopt(name = "import", about = "Import a theme from a tarball")]
    Import { name: String },
    #[structopt(name = "publish", about = "Publish an account online")]
    Publish { name: String },
    #[structopt(name = "create", about = "Create an account")]
    Create {
        name: String,
        pass1: String,
        pass2: String,
    },
    #[structopt(
        name = "delete_user",
        about = "Delete an online user's profile and owned themes"
    )]
    DUser { pass: String },
    #[structopt(name = "logout", about = "Log out of your user profile")]
    Logout,
    #[structopt(name = "unpublish", about = "Delete an online theme")]
    Unpublish { name: String },
    #[structopt(name = "login", about = "Log in to an user's account")]
    Login { name: String, pass: String },
}
#[derive(StructOpt, Debug)]
pub enum Cycle {
    #[structopt(name = "start", about = "Start the daemon")]
    Start,
    #[structopt(name = "check", about = "Check if daemon is running")]
    Check,
    #[structopt(name = "stop", about = "Stop the daemon")]
    Stop,
}