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
mod restart;
mod setup;
mod shutdown;
mod start;

use anyhow::Result;
use clap::Subcommand;

use self::{
    restart::server_restart, setup::server_setup, shutdown::server_shutdown, start::server_start,
};

#[derive(Debug, Subcommand)]
pub enum ServerCommand {
    Restart,
    Setup,
    Shutdown,
    Start,
}

pub fn handle_command_server(command: ServerCommand) -> Result<()> {
    match command {
        ServerCommand::Restart => server_restart(),
        ServerCommand::Setup => server_setup(),
        ServerCommand::Shutdown => server_shutdown(),
        ServerCommand::Start => server_start(),
    }
}