From 899232ff92821c9950578b28ceca05a9aae2b32a Mon Sep 17 00:00:00 2001 From: DuckDuckWhale Date: Sun, 15 Nov 2020 01:44:06 -0800 Subject: [PATCH] Add: fancy table edges --- src/main.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/main.rs b/src/main.rs index 9d6116c..4b2bc24 100644 --- a/src/main.rs +++ b/src/main.rs @@ -66,22 +66,17 @@ fn main() { ); if let Some(max_title_len) = times.iter().map(|(_, title)| title.len()).max() { let max_len = max_title_len + 2; - let separator = format!("+----------+{}+", "-".repeat(max_len)); - println!("{}", separator); + println!("┌──────────┬{}┐", "─".repeat(max_len)); for (time, title) in times { let line = format!( - "| {:0>2}:{:0>2}:{:0>2} | {}", + "│ {:0>2}:{:0>2}:{:0>2} │ {}", time / 3600, time / 60 % 60, time % 60, title ); - println!( - "{}{}|", - line, - " ".repeat(separator.len() - line.width() - 1) - ); + println!("{}{}│", line, " ".repeat(max_len + 13 - line.width() - 1)); } - println!("{}", separator); + println!("└──────────┴{}┘", "─".repeat(max_len)); } }