Add: fancy table edges
This commit is contained in:
parent
6b4f302a4f
commit
899232ff92
13
src/main.rs
13
src/main.rs
@ -66,22 +66,17 @@ fn main() {
|
|||||||
);
|
);
|
||||||
if let Some(max_title_len) = times.iter().map(|(_, title)| title.len()).max() {
|
if let Some(max_title_len) = times.iter().map(|(_, title)| title.len()).max() {
|
||||||
let max_len = max_title_len + 2;
|
let max_len = max_title_len + 2;
|
||||||
let separator = format!("+----------+{}+", "-".repeat(max_len));
|
println!("┌──────────┬{}┐", "─".repeat(max_len));
|
||||||
println!("{}", separator);
|
|
||||||
for (time, title) in times {
|
for (time, title) in times {
|
||||||
let line = format!(
|
let line = format!(
|
||||||
"| {:0>2}:{:0>2}:{:0>2} | {}",
|
"│ {:0>2}:{:0>2}:{:0>2} │ {}",
|
||||||
time / 3600,
|
time / 3600,
|
||||||
time / 60 % 60,
|
time / 60 % 60,
|
||||||
time % 60,
|
time % 60,
|
||||||
title
|
title
|
||||||
);
|
);
|
||||||
println!(
|
println!("{}{}│", line, " ".repeat(max_len + 13 - line.width() - 1));
|
||||||
"{}{}|",
|
|
||||||
line,
|
|
||||||
" ".repeat(separator.len() - line.width() - 1)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
println!("{}", separator);
|
println!("└──────────┴{}┘", "─".repeat(max_len));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user