use std::process::ExitCode; use rdbms_playground::cli::{Args, HELP_TEXT}; use rdbms_playground::{logging, runtime}; fn main() -> ExitCode { let args = match Args::from_env() { Ok(args) => args, Err(e) => { eprintln!("rdbms-playground: {e}"); eprintln!("\n{HELP_TEXT}"); return ExitCode::from(2); } }; if args.help { print!("{HELP_TEXT}"); return ExitCode::SUCCESS; } if let Err(e) = logging::init(args.log_path.as_deref()) { eprintln!("rdbms-playground: failed to initialise logging: {e:#}"); return ExitCode::FAILURE; } let tokio_rt = match tokio::runtime::Runtime::new() { Ok(rt) => rt, Err(e) => { tracing::error!(error = %e, "failed to start tokio runtime"); return ExitCode::FAILURE; } }; match tokio_rt.block_on(runtime::run(args)) { Ok(()) => ExitCode::SUCCESS, Err(e) => { tracing::error!(error = %e, "runtime exited with error"); eprintln!("rdbms-playground: {e:#}"); ExitCode::FAILURE } } }