#![forbid(unsafe_code)] mod cmd; mod configs; mod errors; mod helpers; mod log; mod middlewares; mod routes; mod services; mod tasks; #[tokio::main] async fn main() { // If there are command-line arguments, treat it as a CLI command if std::env::args().len() > 1 { tracing::subscriber::with_default(log::make_temporary_subscriber(), || { use clap::error::ErrorKind; // let mut command = cmd::get_command(); let help_output = format!("{}", command.render_help()); let matches = command .try_get_matches() .unwrap_or_else(|err| match err.kind() { ErrorKind::DisplayHelp | ErrorKind::DisplayVersion => { err.print().expect("Error writing Error"); std::process::exit(0); } _ => { err.print().expect("Error writing Error"); std::process::exit(1); } }); cmd::execute(&matches, &help_output) }) .await; return; } // No command-line arguments, start the server normally cmd::start_server().await; }