Skip to content

Commit 29c2843

Browse files
committed
handle multi-line output
1 parent 2c1b643 commit 29c2843

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/lib.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,17 @@ pub fn print_with_duration(line: &str, output: Option<&str>, duration: Duration)
3939
let width = " - ".len() + line.chars().count() + 1 + duration.chars().count();
4040
let dots = DISPLAY_WIDTH - min(DISPLAY_WIDTH - 5, width) - 2;
4141
let dots: String = iter::repeat('.').take(dots).collect();
42-
println!(" {} {}", dots.dimmed(), output.bold());
42+
print!(" {}", dots.dimmed());
43+
44+
if output.contains('\n') {
45+
println!();
46+
47+
for line in output.trim_matches('\n').lines() {
48+
println!(" {}", line.bold());
49+
}
50+
} else {
51+
println!(" {}", output.bold());
52+
}
4353
} else {
4454
println!()
4555
}

0 commit comments

Comments
 (0)