2022-04-06 23:32:11 -06:00
|
|
|
use clap::Subcommand;
|
2022-04-21 03:12:56 -06:00
|
|
|
use eyre::Result;
|
2021-02-14 10:18:02 -07:00
|
|
|
|
2022-04-21 03:12:56 -06:00
|
|
|
mod client;
|
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 {
|
2022-04-21 03:12:56 -06:00
|
|
|
#[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
|
|
|
|
#[clap(subcommand)]
|
2021-02-14 10:18:02 -07:00
|
|
|
Server(server::Cmd),
|
|
|
|
}
|
2021-02-14 11:00:41 -07:00
|
|
|
|
|
|
|
impl AtuinCmd {
|
2021-04-20 14:53:07 -06:00
|
|
|
pub async fn run(self) -> Result<()> {
|
2021-02-14 11:00:41 -07:00
|
|
|
match self {
|
2022-04-21 03:12:56 -06:00
|
|
|
Self::Client(client) => client.run().await,
|
|
|
|
Self::Server(server) => server.run().await,
|
2021-02-14 11:00:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|