summaryrefslogtreecommitdiff
path: root/cli/main.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2019-05-17 18:35:29 +0200
committerRyan Dahl <ry@tinyclouds.org>2019-05-17 12:35:29 -0400
commit7f6549532c22e5e58deb37334fca06c949902e5f (patch)
tree79e9457285b2c4d5e744dc583a1c3f12b7247b54 /cli/main.rs
parente3e9021d23301ba7ee16dfb2eabc286de38a22cf (diff)
Don't print new line if progress bar was not used (#2374)
Diffstat (limited to 'cli/main.rs')
-rw-r--r--cli/main.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/cli/main.rs b/cli/main.rs
index 2423c4936..ff2ed6006 100644
--- a/cli/main.rs
+++ b/cli/main.rs
@@ -138,11 +138,15 @@ fn create_worker_and_state(
) -> (Worker, ThreadSafeState) {
let progress = Progress::new();
progress.set_callback(|done, completed, total, msg| {
- if done {
- eprintln!("");
- } else {
+ if !done {
eprint!("\r[{}/{}] {}", completed, total, msg);
eprint!("\x1B[K"); // Clear to end of line.
+ return;
+ }
+
+ // print empty line only if progress bar was used
+ if done && total > 0 {
+ eprintln!();
}
});
let state = ThreadSafeState::new(flags, argv, ops::op_selector_std, progress);