eldiron_cli/commands/
server.rs

1mod restart;
2mod setup;
3mod shutdown;
4mod start;
5
6use anyhow::Result;
7use clap::Subcommand;
8
9use self::{
10    restart::server_restart, setup::server_setup, shutdown::server_shutdown, start::server_start,
11};
12
13#[derive(Debug, Subcommand)]
14pub enum ServerCommand {
15    /// Restart server service under systemd.
16    Restart,
17    /// Setup a new server.
18    Setup,
19    /// Shutdown server service under systemd.
20    Shutdown,
21    /// Start server service under systemd.
22    Start,
23}
24
25pub fn handle_command_server(command: ServerCommand) -> Result<()> {
26    match command {
27        ServerCommand::Restart => server_restart(),
28        ServerCommand::Setup => server_setup(),
29        ServerCommand::Shutdown => server_shutdown(),
30        ServerCommand::Start => server_start(),
31    }
32}