aboutsummaryrefslogtreecommitdiffstats
path: root/src/command/mod.rs
blob: c86e76f5f12896ba89c2b630a73393664578d86f (plain) (blame)
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
use clap::Subcommand;
use eyre::Result;

mod client;

#[cfg(feature = "server")]
mod server;

#[derive(Subcommand)]
#[clap(infer_subcommands = true)]
pub enum AtuinCmd {
    #[clap(flatten)]
    Client(client::Cmd),

    /// Start an atuin server
    #[cfg(feature = "server")]
    #[clap(subcommand)]
    Server(server::Cmd),
}

impl AtuinCmd {
    pub fn run(self) -> Result<()> {
        match self {
            Self::Client(client) => client.run(),
            #[cfg(feature = "server")]
            Self::Server(server) => server.run(),
        }
    }
}