Compare commits

...

10 Commits

Author SHA1 Message Date
Christoph J. Scherr 872338c83f Merge branch 'master' of https://git.cscherr.de/PlexSheep/autocrate
cargo devel CI / cargo CI (push) Successful in 2m28s Details
2024-04-26 14:24:29 +02:00
Christoph J. Scherr 411ded1395 more print error 2024-04-26 14:24:23 +02:00
PlexSheep 97b36966d5 automatic cargo CI changes 2024-04-26 08:16:07 +00:00
Christoph J. Scherr e7ab89f050 better error display
cargo devel CI / cargo CI (push) Successful in 2m23s Details
2024-04-26 10:13:47 +02:00
Christoph J. Scherr ca3d1b7e82 Merge branch 'devel'
cargo devel CI / cargo CI (push) Successful in 2m13s Details
2024-04-26 10:07:30 +02:00
Christoph J. Scherr 56d6a50142 Merge branch 'devel'
cargo devel CI / cargo CI (push) Has been cancelled Details
2024-04-26 10:05:58 +02:00
Christoph J. Scherr 5bb4072e24 remodeling our structure with git a bit 2024-04-26 10:03:52 +02:00
PlexSheep 9aa9c8e07b automatic cargo CI changes 2024-04-26 06:58:04 +00:00
Christoph J. Scherr e80b68f1c4 Merge branch 'devel'
cargo devel CI / cargo CI (push) Successful in 3m4s Details
2024-04-26 08:55:01 +02:00
Christoph J. Scherr 378b269fa0 release to forgejo works in an early state
cargo devel CI / cargo CI (push) Failing after 1m41s Details
2024-04-25 15:46:37 +02:00
1 changed files with 23 additions and 4 deletions

View File

@ -1,3 +1,5 @@
use std::error::Error as _;
use autocrate::{
changelog::*,
config::{
@ -9,24 +11,37 @@ use autocrate::{
release::release,
serverapi::ApiCollection,
};
use libpt::log::{debug, error};
#[tokio::main]
async fn main() -> Result<()> {
let cli = Cli::cli_parse();
let cfg = Config::load(&cli)?;
match cli.command {
let status: Option<Error> = match cli.command {
Commands::Changelog { .. } => {
println!("{}", Changelog::build(&cfg)?);
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?;
release(&cfg, &mut apis).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
publish(&cfg).await?;
match publish(&cfg).await {
Ok(_) => None,
Err(err) => Some(err),
}
}
Commands::Version {} => {
// TODO: version bump
@ -39,5 +54,9 @@ async fn main() -> Result<()> {
todo!()
}
};
if let Some(err) = status {
error!("{err}");
debug!("{:#?}", err.source());
}
Ok(())
}