caretta-sync/lazy-supplements-desktop/src/main.rs

27 lines
690 B
Rust
Raw Normal View History

2025-06-01 16:29:35 +09:00
use clap::{Parser, Subcommand};
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
}
}