Skip to content

Commit

Permalink
Tweak output formatting slightly and location
Browse files Browse the repository at this point in the history
* All messages are now printed onto stderr instead of some on stdout and
  some on stderr
* All messages uniformly are prefixed with an emoji with consistent
  spacing.
  • Loading branch information
alexcrichton committed Mar 15, 2019
1 parent ff6005e commit bcbfc4f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
15 changes: 5 additions & 10 deletions src/progressbar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,12 @@ impl ProgressOutput {
/// Inform the user that the given `step` is being executed, with details in
/// `message`.
pub fn step(&self, message: &str) {
let msg = format!("{} {}", style(emoji::INFO).bold().dim(), message);
self.message(&msg)
self.info(message);
}

/// Print the given message.
pub fn message(&self, message: &str) {
eprintln!(" {}", message);
}

fn add_message(&self, msg: &str) {
println!("{}", msg);
eprintln!("{}", message);
}

/// Add an informational message.
Expand All @@ -31,7 +26,7 @@ impl ProgressOutput {
style("[INFO]").bold().dim(),
message
);
self.add_message(&info);
self.message(&info);
}

/// Add a warning message.
Expand All @@ -42,7 +37,7 @@ impl ProgressOutput {
style("[WARN]").bold().dim(),
message
);
self.add_message(&warn);
self.message(&warn);
}

/// Add an error message.
Expand All @@ -53,7 +48,7 @@ impl ProgressOutput {
style("[ERR]").bold().dim(),
message
);
self.add_message(&err);
self.message(&err);
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/all/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ fn parse_crate_data_returns_unused_keys_in_cargo_toml() {
.arg("build")
.assert()
.success()
.stdout(predicates::str::contains(
.stderr(predicates::str::contains(
"[WARN]: \"package.metadata.wasm-pack.profile.production\" is an unknown key and will \
be ignored. Please check your Cargo.toml.",
));
Expand Down

0 comments on commit bcbfc4f

Please sign in to comment.