generated from PlexSheep/rs-base
Compare commits
10 Commits
Author | SHA1 | Date |
---|---|---|
Christoph J. Scherr | 872338c83f | |
Christoph J. Scherr | 411ded1395 | |
PlexSheep | 97b36966d5 | |
Christoph J. Scherr | e7ab89f050 | |
Christoph J. Scherr | ca3d1b7e82 | |
Christoph J. Scherr | 56d6a50142 | |
Christoph J. Scherr | 5bb4072e24 | |
PlexSheep | 9aa9c8e07b | |
Christoph J. Scherr | e80b68f1c4 | |
Christoph J. Scherr | 378b269fa0 |
27
src/main.rs
27
src/main.rs
|
@ -1,3 +1,5 @@
|
||||||
|
use std::error::Error as _;
|
||||||
|
|
||||||
use autocrate::{
|
use autocrate::{
|
||||||
changelog::*,
|
changelog::*,
|
||||||
config::{
|
config::{
|
||||||
|
@ -9,24 +11,37 @@ use autocrate::{
|
||||||
release::release,
|
release::release,
|
||||||
serverapi::ApiCollection,
|
serverapi::ApiCollection,
|
||||||
};
|
};
|
||||||
|
use libpt::log::{debug, error};
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<()> {
|
||||||
let cli = Cli::cli_parse();
|
let cli = Cli::cli_parse();
|
||||||
let cfg = Config::load(&cli)?;
|
let cfg = Config::load(&cli)?;
|
||||||
|
|
||||||
match cli.command {
|
let status: Option<Error> = match cli.command {
|
||||||
Commands::Changelog { .. } => {
|
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 { .. } => {
|
Commands::Release { .. } => {
|
||||||
// TODO: check if repo is dirty and create a commit with a given option
|
// TODO: check if repo is dirty and create a commit with a given option
|
||||||
let mut apis = ApiCollection::build(&cfg).await?;
|
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 { .. } => {
|
Commands::Publish { .. } => {
|
||||||
// TODO: check if repo is dirty and create a commit with a given option
|
// 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 {} => {
|
Commands::Version {} => {
|
||||||
// TODO: version bump
|
// TODO: version bump
|
||||||
|
@ -39,5 +54,9 @@ async fn main() -> Result<()> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
if let Some(err) = status {
|
||||||
|
error!("{err}");
|
||||||
|
debug!("{:#?}", err.source());
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue