use autocrate::{ changelog::*, config::{ cli::{Cli, Commands}, Config, }, error::*, publish::publish, release::release, serverapi::ApiCollection, }; use libpt::log::error; #[tokio::main] async fn main() -> Result<()> { let cli = Cli::cli_parse(); let cfg = Config::load(&cli)?; let status: Option = match cli.command { Commands::Changelog { .. } => { let chlog = Changelog::build(&cfg); if chlog.is_ok() { println!("{}", chlog.unwrap()); None } else { Some(chlog.unwrap_err()) } } Commands::Release { .. } => { // TODO: check if repo is dirty and create a commit with a given option let mut apis = ApiCollection::build(&cfg).await?; match release(&cfg, &mut apis).await { Ok(_) => None, Err(err) => Some(err), } } Commands::Publish { .. } => { // TODO: check if repo is dirty and create a commit with a given option match publish(&cfg).await { Ok(_) => None, Err(err) => Some(err), } } Commands::Version {} => { // TODO: version bump // TODO: version select interactive // TODO: version select automated todo!() } Commands::Init { .. } => { // TODO: create a basic autocrate yaml todo!() } }; if let Some(err) = status { error!("{err}"); } Ok(()) }