mirror of
https://github.com/denoland/deno.git
synced 2024-10-29 08:58:01 -04:00
Don't print new line if progress bar was not used (#2374)
This commit is contained in:
parent
e3e9021d23
commit
7f6549532c
1 changed files with 7 additions and 3 deletions
10
cli/main.rs
10
cli/main.rs
|
@ -138,11 +138,15 @@ fn create_worker_and_state(
|
||||||
) -> (Worker, ThreadSafeState) {
|
) -> (Worker, ThreadSafeState) {
|
||||||
let progress = Progress::new();
|
let progress = Progress::new();
|
||||||
progress.set_callback(|done, completed, total, msg| {
|
progress.set_callback(|done, completed, total, msg| {
|
||||||
if done {
|
if !done {
|
||||||
eprintln!("");
|
|
||||||
} else {
|
|
||||||
eprint!("\r[{}/{}] {}", completed, total, msg);
|
eprint!("\r[{}/{}] {}", completed, total, msg);
|
||||||
eprint!("\x1B[K"); // Clear to end of line.
|
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);
|
let state = ThreadSafeState::new(flags, argv, ops::op_selector_std, progress);
|
||||||
|
|
Loading…
Reference in a new issue