Skip to content

Commit

Permalink
switched to log::debug! from println! for plug subcommand; skippe…
Browse files Browse the repository at this point in the history
…d using the progress bar output when only one thing to do
  • Loading branch information
calvinrp committed May 13, 2024
1 parent dc3081f commit e28403e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
4 changes: 0 additions & 4 deletions crates/wac-resolver/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand All @@ -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");
Expand Down
14 changes: 7 additions & 7 deletions src/commands/plug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
Expand All @@ -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()
Expand All @@ -132,7 +132,7 @@ impl PlugCommand {
}
}
PackageRef::LocalPath(path) => {
println!("Plugging `{path}`", path = path.display());
log::debug!("Plugging `{path}`", path = path.display());

path.clone()
}
Expand Down Expand Up @@ -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()
);
Expand All @@ -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()
Expand All @@ -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())
}
};
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit e28403e

Please sign in to comment.