2025-06-01 16:29:35 +09:00
|
|
|
use clap::{Parser, Subcommand};
|
2025-06-11 08:38:03 +09:00
|
|
|
use lazy_supplements_desktop::{cli::{ConfigArgs, NodeArgs, NodeCommand, ServerArgs}, global::{Global, GLOBAL}, *};
|
2025-06-01 16:29:35 +09:00
|
|
|
|
|
|
|
#[derive(Debug, Parser)]
|
|
|
|
struct Cli {
|
|
|
|
#[command(subcommand)]
|
|
|
|
command: Command,
|
2025-06-07 09:28:18 +09:00
|
|
|
#[command(flatten)]
|
|
|
|
pub config: ConfigArgs,
|
2025-06-01 16:29:35 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Subcommand)]
|
|
|
|
enum Command {
|
|
|
|
Node(NodeArgs),
|
2025-06-02 12:02:04 +09:00
|
|
|
Server(ServerArgs),
|
2025-06-01 16:29:35 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[tokio::main]
|
|
|
|
async fn main() {
|
2025-06-07 09:28:18 +09:00
|
|
|
let cli = Cli::parse();
|
2025-06-18 08:36:01 +09:00
|
|
|
let _ = GLOBAL.get_or_init_core_config(cli.config.try_into_core_config().await.unwrap()).await;
|
2025-06-07 09:28:18 +09:00
|
|
|
match cli.command {
|
|
|
|
Command::Node(x) => x.run().await.unwrap(),
|
2025-06-02 12:02:04 +09:00
|
|
|
Command::Server(x) => x.start_server().await.unwrap(),
|
2025-06-01 16:29:35 +09:00
|
|
|
}
|
|
|
|
}
|