Add start server command and logging setup for CLI

This commit is contained in:
GW_MC
2025-12-05 18:03:17 +08:00
parent d2b842d933
commit 65d40c1e83
5 changed files with 192 additions and 163 deletions

View File

@@ -1,22 +1,26 @@
mod generate_openapi;
mod start_server;
pub use start_server::start_server;
use std::pin::Pin;
use std::{future::Future, process::exit};
use clap::{ArgMatches, Command};
pub mod generate_openapi;
pub struct CliCommand {
pub command: Command,
pub action: fn(&clap::ArgMatches) -> Pin<Box<dyn std::future::Future<Output = ()> + Send>>,
}
static CLI_COMMANDS: once_cell::sync::Lazy<
[CliCommand; 1 /* Update this count when adding new commands */],
[CliCommand; 2 /* Update this count when adding new commands */],
> =
once_cell::sync::Lazy::new(|| {
[
// Add new commands here
generate_openapi::get_cli_command(),
start_server::get_cli_command(),
]
});