2025-06-01 16:29:35 +09:00
|
|
|
use clap::{Parser, Subcommand};
|
2025-06-06 06:50:28 +09:00
|
|
|
use lazy_supplements::{cli::{ConsoleArgs, ConsoleCommands, InitArgs, NodeArgs, NodeCommand, ServerArgs}, *};
|
2025-06-01 16:29:35 +09:00
|
|
|
|
|
|
|
#[derive(Debug, Parser)]
|
|
|
|
struct Cli {
|
|
|
|
#[command(subcommand)]
|
|
|
|
command: Command,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Subcommand)]
|
|
|
|
enum Command {
|
2025-06-05 09:23:24 +09:00
|
|
|
Console(ConsoleArgs),
|
2025-06-01 16:29:35 +09:00
|
|
|
Node(NodeArgs),
|
|
|
|
Init(InitArgs),
|
2025-06-02 12:02:04 +09:00
|
|
|
Server(ServerArgs),
|
2025-06-01 16:29:35 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[tokio::main]
|
|
|
|
async fn main() {
|
|
|
|
match Cli::parse().command {
|
|
|
|
Command::Node(x) => match x.command {
|
|
|
|
NodeCommand::Ping(y) => y.ping().await.unwrap(),
|
|
|
|
NodeCommand::Join(y) => println!("{y:?}"),
|
|
|
|
},
|
|
|
|
Command::Init(x) => x.init_config().await,
|
2025-06-02 12:02:04 +09:00
|
|
|
Command::Server(x) => x.start_server().await.unwrap(),
|
2025-06-06 06:50:28 +09:00
|
|
|
Command::Console(x) => x.start_console(ConsoleCommands::default()).await.unwrap(),
|
2025-06-01 16:29:35 +09:00
|
|
|
}
|
|
|
|
}
|