aboutsummaryrefslogtreecommitdiffstats
path: root/src/command/mod.rs
blob: ca7fc72405c7bb5962ff3794a68bcfde5ff0bf7d (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
30
31
32
use clap::Subcommand;
use eyre::Result;

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

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

#[derive(Subcommand)]
#[clap(infer_subcommands = true)]
pub enum AtuinCmd {
    #[cfg(feature = "client")]
    #[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 {
            #[cfg(feature = "client")]
            Self::Client(client) => client.run(),
            #[cfg(feature = "server")]
            Self::Server(server) => server.run(),
        }
    }
}