atuin/src/command/mod.rs

33 lines
658 B
Rust
Raw Normal View History

2022-04-06 23:32:11 -06:00
use clap::Subcommand;
use eyre::Result;
2021-02-14 10:18:02 -07:00
#[cfg(feature = "client")]
mod client;
#[cfg(feature = "server")]
2021-02-14 10:18:02 -07:00
mod server;
2022-04-06 23:32:11 -06:00
#[derive(Subcommand)]
#[clap(infer_subcommands = true)]
2021-02-14 10:18:02 -07:00
pub enum AtuinCmd {
#[cfg(feature = "client")]
#[clap(flatten)]
Client(client::Cmd),
2021-02-14 10:18:02 -07:00
2022-04-06 23:32:11 -06:00
/// Start an atuin server
#[cfg(feature = "server")]
2022-04-06 23:32:11 -06:00
#[clap(subcommand)]
2021-02-14 10:18:02 -07:00
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(),
}
}
}