30 lines
No EOL
821 B
Rust
30 lines
No EOL
821 B
Rust
use clap::{Parser, Subcommand};
|
|
use lazy_supplements::{cli::{ConsoleArgs, ConsoleCommands, InitArgs, NodeArgs, NodeCommand, ServerArgs}, *};
|
|
|
|
#[derive(Debug, Parser)]
|
|
struct Cli {
|
|
#[command(subcommand)]
|
|
command: Command,
|
|
}
|
|
|
|
#[derive(Debug, Subcommand)]
|
|
enum Command {
|
|
Console(ConsoleArgs),
|
|
Node(NodeArgs),
|
|
Init(InitArgs),
|
|
Server(ServerArgs),
|
|
}
|
|
|
|
|
|
#[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,
|
|
Command::Server(x) => x.start_server().await.unwrap(),
|
|
Command::Console(x) => x.start_console(ConsoleCommands::default()).await.unwrap(),
|
|
}
|
|
} |