aboutsummaryrefslogtreecommitdiffstats
path: root/src/command/mod.rs
blob: 953b76badd21dd1c89d60e437029caae62126c99 (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 async fn run(self) -> Result<()> {
        match self {
            Self::Client(client) => client.run().await,
            #[cfg(feature = "server")]
            Self::Server(server) => server.run().await,
        }
    }
}