2021-08-24 10:23:37 +02:00
|
|
|
use std::env::var;
|
2020-06-24 16:17:59 +02:00
|
|
|
|
2021-07-16 15:33:04 +02:00
|
|
|
use color_eyre::eyre::Result;
|
2021-08-24 10:23:37 +02:00
|
|
|
use tracing_subscriber::filter::LevelFilter;
|
|
|
|
use watchexec::Watchexec;
|
2021-05-10 12:44:35 +02:00
|
|
|
|
2021-04-10 15:33:40 +02:00
|
|
|
mod args;
|
2021-08-24 10:23:37 +02:00
|
|
|
mod config;
|
2016-09-14 15:30:59 +02:00
|
|
|
|
2021-08-24 10:23:37 +02:00
|
|
|
#[tokio::main]
|
|
|
|
async fn main() -> Result<()> {
|
|
|
|
color_eyre::install()?;
|
2020-06-24 16:17:59 +02:00
|
|
|
|
2021-08-24 10:23:37 +02:00
|
|
|
if var("RUST_LOG").is_ok() {
|
|
|
|
tracing_subscriber::fmt::init();
|
|
|
|
}
|
2021-05-10 12:44:35 +02:00
|
|
|
|
2021-08-24 10:23:37 +02:00
|
|
|
let args = args::get_args()?;
|
|
|
|
|
|
|
|
if args.is_present("verbose") {
|
|
|
|
tracing_subscriber::fmt()
|
|
|
|
.with_max_level(LevelFilter::DEBUG)
|
|
|
|
.try_init()
|
|
|
|
.ok();
|
|
|
|
}
|
|
|
|
|
|
|
|
let (init, runtime) = config::new(&args)?;
|
|
|
|
|
|
|
|
let config = runtime.clone();
|
|
|
|
let wx = Watchexec::new(init, runtime)?;
|
|
|
|
|
|
|
|
wx.main().await??;
|
|
|
|
|
|
|
|
Ok(())
|
2020-06-24 16:17:59 +02:00
|
|
|
}
|