diff --git a/Cargo.lock b/Cargo.lock index 29bec3c5..eba1b200 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -432,12 +432,6 @@ dependencies = [ "syn", ] -[[package]] -name = "diff" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" - [[package]] name = "difflib" version = "0.4.0" @@ -709,12 +703,6 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" -[[package]] -name = "futures-timer" -version = "3.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" - [[package]] name = "futures-util" version = "0.3.31" @@ -767,12 +755,6 @@ dependencies = [ "url", ] -[[package]] -name = "glob" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" - [[package]] name = "h2" version = "0.4.7" @@ -885,11 +867,9 @@ dependencies = [ "log", "maplit", "octocrab", - "pretty_assertions", "rayon", "regex", "reqwest", - "rstest", "scopeguard", "semver", "serde", @@ -1740,16 +1720,6 @@ dependencies = [ "termtree", ] -[[package]] -name = "pretty_assertions" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d" -dependencies = [ - "diff", - "yansi", -] - [[package]] name = "pretty_env_logger" version = "0.3.1" @@ -1775,15 +1745,6 @@ dependencies = [ "unicode-width 0.1.14", ] -[[package]] -name = "proc-macro-crate" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" -dependencies = [ - "toml_edit", -] - [[package]] name = "proc-macro2" version = "1.0.92" @@ -1877,12 +1838,6 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" -[[package]] -name = "relative-path" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba39f3699c378cd8970968dcbff9c43159ea4cfbd88d43c00b22f2ef10a435d2" - [[package]] name = "reqwest" version = "0.12.12" @@ -1942,51 +1897,12 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "rstest" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03e905296805ab93e13c1ec3a03f4b6c4f35e9498a3d5fa96dc626d22c03cd89" -dependencies = [ - "futures-timer", - "futures-util", - "rstest_macros", - "rustc_version", -] - -[[package]] -name = "rstest_macros" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef0053bbffce09062bee4bcc499b0fbe7a57b879f1efe088d6d8d4c7adcdef9b" -dependencies = [ - "cfg-if", - "glob", - "proc-macro-crate", - "proc-macro2", - "quote", - "regex", - "relative-path", - "rustc_version", - "syn", - "unicode-ident", -] - [[package]] name = "rustc-demangle" version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" -[[package]] -name = "rustc_version" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" -dependencies = [ - "semver", -] - [[package]] name = "rustix" version = "0.38.43" @@ -2548,23 +2464,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "toml_datetime" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" - -[[package]] -name = "toml_edit" -version = "0.22.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" -dependencies = [ - "indexmap", - "toml_datetime", - "winnow", -] - [[package]] name = "tower" version = "0.5.2" @@ -3115,15 +3014,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" -[[package]] -name = "winnow" -version = "0.6.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39281189af81c07ec09db316b302a3e67bf9bd7cbf6c820b50e35fee9c2fa980" -dependencies = [ - "memchr", -] - [[package]] name = "write16" version = "1.0.0" @@ -3136,12 +3026,6 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" -[[package]] -name = "yansi" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" - [[package]] name = "yoke" version = "0.7.5" diff --git a/huber-common/src/log.rs b/huber-common/src/log.rs index bbc23eca..fe866cc2 100644 --- a/huber-common/src/log.rs +++ b/huber-common/src/log.rs @@ -1,5 +1,4 @@ use std::str::FromStr; - use log::LevelFilter; use crate::model::config::Config; diff --git a/huber/Cargo.toml b/huber/Cargo.toml index d0da20ab..55c274a8 100644 --- a/huber/Cargo.toml +++ b/huber/Cargo.toml @@ -20,8 +20,6 @@ chrono.workspace = true [dev-dependencies] assert_cmd = "2.0.16" -pretty_assertions = "1.4.1" -rstest = "0.24.0" whoami = "1.5.2" [dependencies] diff --git a/huber/src/bin/huber.rs b/huber/src/bin/huber.rs index 9efcc71f..d3eba29c 100644 --- a/huber/src/bin/huber.rs +++ b/huber/src/bin/huber.rs @@ -9,6 +9,7 @@ use anyhow::anyhow; use clap::{CommandFactory, Parser, ValueHint}; use clap_complete::Generator; use huber::cmd::config::ConfigCommands; +use huber::cmd::lock::LockCommands; use huber::cmd::repo::RepoCommands; use huber::cmd::CommandTrait; use huber::cmd::Commands; @@ -19,11 +20,10 @@ use huber_common::fs::dir; use huber_common::log::Logger; use huber_common::model::config::Config; use libcli_rs::output::OutputFormat; -use log::{error, warn, LevelFilter}; +use log::{error, LevelFilter}; use scopeguard::defer; use simpledi_rs::di::{DIContainer, DIContainerTrait, DependencyInjectTrait}; use simpledi_rs::inject_dep; -use huber::cmd::lock::LockCommands; #[derive(Parser)] #[command(version, bin_name = env!("CARGO_PKG_NAME"), about, long_about = None)] @@ -149,7 +149,7 @@ async fn main() { if let Some(e) = e.downcast_ref::() { let source_err = e.source().map(|e| format!(": {}", e)).unwrap_or_default(); - warn!("{}{}", e, source_err); + error!("{}{}", e, source_err); } else { error!("{}", e); } diff --git a/huber/tests/config.rs b/huber/tests/config.rs index 98c38f40..a36b0f61 100644 --- a/huber/tests/config.rs +++ b/huber/tests/config.rs @@ -14,7 +14,7 @@ fn test_config_not_found() { } huber_cmd!(arg("config").arg("show").assert().failure().stderr(format!( - "[WARN ] Config not found: \"/home/{}/.huber/config.yaml\"\n", + "[ERROR] Config not found: \"/home/{}/.huber/config.yaml\"\n", username() ))); } diff --git a/huber/tests/current.rs b/huber/tests/current.rs index 9bbeb529..7a1033a9 100644 --- a/huber/tests/current.rs +++ b/huber/tests/current.rs @@ -36,7 +36,7 @@ fn test_current_fail() { .assert() .failure() .stderr(format!( - "[WARN ] Package not installed: \"{}\"\n", + "[ERROR] Package not installed: \"{}\"\n", INVALID_PKG ))); } diff --git a/huber/tests/info.rs b/huber/tests/info.rs index 3a845da6..9862f056 100644 --- a/huber/tests/info.rs +++ b/huber/tests/info.rs @@ -27,5 +27,5 @@ fn test_info_fail() { .arg(INVALID_PKG) .assert() .failure() - .stderr(format!("[WARN ] Package not found: \"{}\"\n", INVALID_PKG))); + .stderr(format!("[ERROR] Package not found: \"{}\"\n", INVALID_PKG))); } diff --git a/huber/tests/install.rs b/huber/tests/install.rs index 1c36555b..21e7f7b4 100644 --- a/huber/tests/install.rs +++ b/huber/tests/install.rs @@ -30,5 +30,5 @@ fn test_install_fail() { .arg(INVALID_PKG_VERSION) .assert() .failure() - .stderr("[WARN ] Package not found: \"pkg_notfound\"\n")); + .stderr("[ERROR] Package not found: \"pkg_notfound\"\n")); } diff --git a/huber/tests/lock.rs b/huber/tests/lock.rs index 25fd2d3d..54db0c1a 100644 --- a/huber/tests/lock.rs +++ b/huber/tests/lock.rs @@ -29,7 +29,7 @@ fn test_lock_fail() { assert_eq_last_line!( assert.get_output().stderr, - "[WARN ] Package unable to lock: Package not installed: \"k9s\"" + "[ERROR] Package unable to lock: Package not installed: \"k9s\"" ); } diff --git a/huber/tests/uninstall.rs b/huber/tests/uninstall.rs index ad3bbea0..ce14d4e9 100644 --- a/huber/tests/uninstall.rs +++ b/huber/tests/uninstall.rs @@ -28,5 +28,5 @@ fn test_uninstall_fail() { .arg(INVALID_PKG) .assert() .failure() - .stderr(format!("[WARN ] Package not found: \"{}\"\n", INVALID_PKG))); + .stderr(format!("[ERROR] Package not found: \"{}\"\n", INVALID_PKG))); } diff --git a/justfile b/justfile index f2c402da..d5bca31a 100644 --- a/justfile +++ b/justfile @@ -26,6 +26,8 @@ fmt: # Fix code fix: + @cargo install cargo-udeps + @cargo +nightly udeps --all-targets @cargo {{ cargo_opts }} fix --allow-dirty --allow-staged # Release binaries