add logging

This commit is contained in:
2022-11-21 14:09:03 +01:00
parent dce155979e
commit af875e4688
14 changed files with 244 additions and 23 deletions

View File

@@ -9,6 +9,7 @@ edition = "2021"
octopush_infra = { path = "../octopush_infra" }
octopush_core = { path = "../octopush_core" }
clap = { version = "4.0.18" }
eyre = { workspace = true }
tracing = { workspace = true }
clap = { version = "4.0.18" }

View File

@@ -16,7 +16,7 @@ pub fn execute_cmd() -> Command {
}
pub async fn execute_subcommand(args: &ArgMatches) -> eyre::Result<()> {
let action = args
let _action = args
.get_one::<String>("action")
.ok_or(eyre::anyhow!("--action is required"))?;

View File

@@ -27,6 +27,7 @@ impl OctopushCli {
match matches.subcommand() {
Some(("execute", execute_sub)) => {
tracing::debug!("executing subcommand 'execute'");
commands::execute::execute_subcommand(execute_sub).await?;
}
Some(_) => return Err(eyre::anyhow!("unknown subcommand, please see --help")),

View File

@@ -9,6 +9,7 @@ edition = "2021"
async-trait = { workspace = true }
eyre = { workspace = true }
tokio = { workspace = true }
rand = "0.8.5"
hex = "0.4.3"
git2 = "0.15.0"

View File

@@ -1,9 +1,12 @@
use std::sync::Arc;
use async_trait::async_trait;
pub mod github;
#[async_trait::async_trait]
#[async_trait]
pub trait GitProvider {
async fn clone_from_url(&self, url: String) -> eyre::Result<()>;
}
pub type DynGitProvider = Arc<dyn GitProvider + Send + Sync>;

View File

@@ -1,16 +1 @@
pub mod service_register;
pub fn add(left: usize, right: usize) -> usize {
left + right
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}