#[cfg(target_env = "musl")]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
#[tokio::main(flavor = "multi_thread", worker_threads = 4)]
async fn main() {
context7_cli::platform::init_platform();
let _log_guard = match context7_cli::init_logging() {
Ok(guard) => guard,
Err(e) => {
eprintln!("Error: failed to initialise logging: {e}");
std::process::exit(74); }
};
if let Err(e) = context7_cli::run().await {
let code = e
.downcast_ref::<context7_cli::errors::Context7Error>()
.map(|ec| ec.exit_code())
.unwrap_or(1);
let msg = e.to_string();
if !msg.is_empty() {
eprintln!("Error: {e:#}");
}
std::process::exit(code);
}
}