lune/src/main.rs

50 lines
1.2 KiB
Rust
Raw Normal View History

2023-01-20 23:40:31 -05:00
#![deny(clippy::all)]
#![warn(clippy::cargo, clippy::pedantic)]
#![allow(
2023-02-05 19:13:58 -05:00
clippy::cargo_common_metadata,
clippy::match_bool,
clippy::module_name_repetitions,
clippy::multiple_crate_versions,
clippy::needless_pass_by_value
)]
2023-01-18 21:11:47 -05:00
use std::process::ExitCode;
pub(crate) mod cli;
pub(crate) mod executor;
2023-01-18 20:47:14 -05:00
use cli::Cli;
use console::style;
2023-01-18 20:47:14 -05:00
#[tokio::main(flavor = "multi_thread")]
async fn main() -> ExitCode {
tracing_subscriber::fmt()
.compact()
2023-08-22 10:47:09 -05:00
.with_env_filter(tracing_subscriber::filter::EnvFilter::from_default_env())
.with_target(true)
.with_timer(tracing_subscriber::fmt::time::uptime())
.with_level(true)
2023-04-30 20:48:47 +02:00
.init();
let (is_standalone, bin) = executor::check_env().await;
if is_standalone {
// It's fine to unwrap here since we don't want to continue
// if something fails
return executor::run_standalone(bin).await.unwrap();
}
match Cli::new().run().await {
Ok(code) => code,
Err(err) => {
eprintln!(
"{}{}{}\n{err:?}",
style("[").dim(),
style("ERROR").red(),
style("]").dim(),
);
ExitCode::FAILURE
}
}
2023-01-18 20:47:14 -05:00
}