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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
use clap::Subcommand;

pub mod account;
pub use account::Account;
pub mod address;
pub use address::Address;
pub mod dns;
pub use dns::Dns;
pub mod email;
pub use email::Email;
pub mod now;
pub use now::Now;
pub mod pastebin;
pub use pastebin::Pastebin;
pub mod purl;
pub use purl::Purl;
pub mod status;
pub use status::Status;
pub mod theme;
pub use theme::Theme;
pub mod web;
pub use web::Web;
pub mod weblog;
pub use weblog::Weblog;

// TODO: allow content fields for some commands to provide filepaths, using the content of the file instead
#[derive(Subcommand)]
pub enum Commands {
    /// Get information and make changes to your account
    Account {
        /// Email of your omg.lol account, needed for Account commands only
        #[clap(short, long, global = true)]
        email: String,
        #[clap(subcommand)]
        command: Account,
    },
    /// Get information and make changes to your addresses
    Address {
        /// omg.lol address to interact with
        #[clap(short, long, global = true)]
        address: Option<String>,
        #[clap(subcommand)]
        command: Address,
    },
    /// Save your omg.lol API key to the config.json (Rather than using the OMGLOL_API_KEY environment variable)
    Auth {
        /// API key to save to config.json
        api_key: String,
    },
    /// Get the address directory, consisting of addresses that have opted-in to be listed
    Directory,
    /// Adjust the switchboard / DNS records for your omg.lol address
    Dns {
        /// omg.lol address to interact with
        #[clap(short, long, global = true)]
        address: Option<String>,
        #[clap(subcommand)]
        command: Dns,
    },
    /// Manage the email configuration for an omg.lol address
    Email {
        /// omg.lol address to interact with
        #[clap(short, long, global = true)]
        address: Option<String>,
        #[clap(subcommand)]
        command: Email,
    },
    /// Manage your /now page
    Now {
        /// omg.lol address to interact with
        #[clap(short, long, global = true)]
        address: Option<String>,
        #[clap(subcommand)]
        command: Now,
    },
    /// Manage the pastebin for an omg.lol address
    Pastebin {
        /// omg.lol address to interact with
        #[clap(short, long, global = true)]
        address: Option<String>,
        #[clap(subcommand)]
        command: Pastebin,
    },
    /// Manage preferences for omg.lol accounts, addresses and objects
    Preferences {
        /// Account to change settings for
        owner: String,
        /// ID of setting to update
        item: String,
        /// Value to set "item" to
        value: String,
    },
    /// Manage PURLs (Persistent URLs) for your omg.lol address
    Purl {
        /// omg.lol address to interact with
        #[clap(short, long, global = true)]
        address: Option<String>,
        #[clap(subcommand)]
        command: Purl,
    },
    /// Get service information about omg.lol
    Service,
    /// Manage the statuslog for an omg.lol address
    Status {
        /// omg.lol address to interact with
        #[clap(short, long, global = true)]
        address: Option<String>,
        #[clap(subcommand)]
        command: Status,
    },
    /// Manage omg.lol profile themes
    Theme {
        /// omg.lol address to interact with
        #[clap(short, long, global = true)]
        address: Option<String>,
        #[clap(subcommand)]
        command: Theme,
    },
    /// Manage profile page and web stuff for an omg.lol address
    Web {
        /// omg.lol address to interact with
        #[clap(short, long, global = true)]
        address: Option<String>,
        #[clap(subcommand)]
        command: Web,
    },
    /// Manage the weblog for an omg.lol address
    Weblog {
        /// omg.lol address to interact with
        #[clap(short, long, global = true)]
        address: Option<String>,
        #[clap(subcommand)]
        command: Weblog,
    },
}

impl Commands {
    fn process(&self) {
        match self {
            Commands::Account { email, command } => {
                command.process(email);
            }
            Commands::Address { address, command } => todo!(),
            Commands::Auth { api_key } => todo!(),
            Commands::Directory => todo!(),
            Commands::Dns { address, command } => todo!(),
            Commands::Email { address, command } => todo!(),
            Commands::Now { address, command } => todo!(),
            Commands::Pastebin { address, command } => todo!(),
            Commands::Preferences { owner, item, value } => todo!(),
            Commands::Purl { address, command } => todo!(),
            Commands::Service => todo!(),
            Commands::Status { address, command } => todo!(),
            Commands::Theme { address, command } => todo!(),
            Commands::Web { address, command } => todo!(),
            Commands::Weblog { address, command } => todo!(),
        }
    }
}