From be87ec58f75a937579222877cd55a9624c8a1c21 Mon Sep 17 00:00:00 2001 From: phra Date: Mon, 20 May 2019 19:09:14 +0200 Subject: [PATCH] fix: improve results on stdout --- src/main.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index e797e4e..0bf6d56 100644 --- a/src/main.rs +++ b/src/main.rs @@ -334,11 +334,20 @@ fn main() { let was_added = result_processor.maybe_add_result(msg.clone()); if was_added { let mut extra = msg.extra.unwrap_or("".to_owned()); + if !extra.is_empty() { - extra = format!("\n\t\t\t\t\t=> {}", extra) + extra = format!("\n\t\t\t\t\t\t=> {}", extra) } - bar.println(format!("{} {}\t\t\t{}{}", msg.method, msg.status, msg.url, extra)); + let n_tabs = match msg.status.len() / 8 { + 3 => 1, + 2 => 2, + 1 => 3, + 0 => 4, + _ => 0, + }; + + bar.println(format!("{}\t{}{}{}{}", msg.method, msg.status, "\t".repeat(n_tabs), msg.url, extra)); } }