use std::{ env::current_dir, sync::{Arc, Mutex}, }; use config::CuddleConfig; use tracing::Level; mod actions; mod cli; mod config; mod context; mod model; fn main() -> anyhow::Result<()> { init_logging()?; let config = CuddleConfig::from_env()?; match git2::Repository::open(current_dir()?) { Ok(_) => { let context = context::extract_cuddle(config.clone())?; _ = cli::CuddleCli::new(context)?.execute()?; } Err(_) => { // Only build bare bones cli log::info!("was not opened in a repo with git, only showing bare-bones options"); _ = cli::CuddleCli::new(Arc::new(Mutex::new(vec![])))?.execute()?; } } Ok(()) } fn init_logging() -> anyhow::Result<()> { tracing_subscriber::fmt() .pretty() .with_max_level(Level::DEBUG) .init(); Ok(()) }