From e28403e04b426727a89e2943f24c7b78a8e519d3 Mon Sep 17 00:00:00 2001 From: Calvin Prewitt Date: Mon, 13 May 2024 07:05:49 -0500 Subject: [PATCH] switched to `log::debug!` from `println!` for plug subcommand; skipped using the progress bar output when only one thing to do --- crates/wac-resolver/src/registry.rs | 4 ---- src/commands/plug.rs | 14 +++++++------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/crates/wac-resolver/src/registry.rs b/crates/wac-resolver/src/registry.rs index bf34948..2e36e7f 100644 --- a/crates/wac-resolver/src/registry.rs +++ b/crates/wac-resolver/src/registry.rs @@ -86,7 +86,6 @@ impl RegistryPackageResolver { // fetch required package logs and return error if any not found if let Some(bar) = self.bar.as_ref() { - bar.init(1); bar.println("Updating", "package logs from the registry"); } @@ -108,9 +107,6 @@ impl RegistryPackageResolver { } if let Some(bar) = self.bar.as_ref() { - bar.inc(1); - bar.finish(); - // download package content if not in cache bar.init(keys.len()); bar.println("Downloading", "package content from the registry"); diff --git a/src/commands/plug.rs b/src/commands/plug.rs index 4539e71..d0ebaa5 100644 --- a/src/commands/plug.rs +++ b/src/commands/plug.rs @@ -112,7 +112,7 @@ impl PlugCommand { if let Some(ver) = version { let download = client.download_exact(name, ver).await?; - println!( + log::debug!( "Plugging `{name}` version `{ver}` using registry `{registry}`", registry = client.url() ); @@ -123,7 +123,7 @@ impl PlugCommand { .await? .ok_or_else(|| anyhow::anyhow!("package `{name}` was not found"))?; - println!( + log::debug!( "Plugging `{name}` version `{ver}` using registry `{registry}`", ver = &download.version, registry = client.url() @@ -132,7 +132,7 @@ impl PlugCommand { } } PackageRef::LocalPath(path) => { - println!("Plugging `{path}`", path = path.display()); + log::debug!("Plugging `{path}`", path = path.display()); path.clone() } @@ -178,7 +178,7 @@ impl PlugCommand { let path = if let Some(ver) = version { let download = client.download_exact(name, ver).await?; - println!( + log::debug!( " with `{name}` version `{ver}` using registry `{registry}`", registry = client.url() ); @@ -189,7 +189,7 @@ impl PlugCommand { .await? .ok_or_else(|| anyhow::anyhow!("package `{name}` was not found"))?; - println!( + log::debug!( " with `{name}` version `{ver}` using registry `{registry}`", ver = &download.version, registry = client.url() @@ -201,7 +201,7 @@ impl PlugCommand { (name, path) } PackageRef::LocalPath(path) => { - println!(" with `{path}`", path = path.display()); + log::debug!(" with `{path}`", path = path.display()); (format!("plug:{name}"), path.clone()) } }; @@ -252,7 +252,7 @@ impl PlugCommand { "failed to write output file `{path}`", path = path.display() ))?; - println!("\nWrote plugged component: `{path}`", path = path.display()); + log::debug!("\nWrote plugged component: `{path}`", path = path.display()); } None => { std::io::stdout()