cuddle-v2/cuddle/src/main.rs

32 lines
619 B
Rust
Raw Normal View History

2022-08-10 16:46:56 +02:00
use config::CuddleConfig;
use tracing_subscriber::prelude::*;
use tracing_subscriber::{fmt, EnvFilter};
2022-08-10 16:46:56 +02:00
mod actions;
2022-08-10 12:34:04 +02:00
mod cli;
2022-08-10 16:46:56 +02:00
mod config;
2022-08-10 12:34:04 +02:00
mod context;
mod model;
2022-08-14 20:19:29 +02:00
mod util;
2022-08-09 17:53:53 +02:00
fn main() -> anyhow::Result<()> {
2022-08-10 17:55:56 +02:00
init_logging()?;
let _ = dotenv::dotenv();
2022-08-10 17:33:31 +02:00
2022-08-10 16:46:56 +02:00
let config = CuddleConfig::from_env()?;
2022-08-09 17:53:53 +02:00
2022-08-14 20:19:29 +02:00
let context = context::extract_cuddle(config.clone())?;
2022-08-14 21:06:07 +02:00
_ = cli::CuddleCli::new(context, config)?.execute()?;
2022-08-09 17:53:53 +02:00
Ok(())
}
2022-08-10 17:55:56 +02:00
fn init_logging() -> anyhow::Result<()> {
tracing_subscriber::registry()
.with(fmt::layer())
.with(EnvFilter::from_default_env())
.init();
2022-08-10 17:55:56 +02:00
Ok(())
}