2020-01-28 05:18:19 +01:00
|
|
|
module term
|
|
|
|
// h_divider will return a horizontal divider line with a dynamic width,
|
|
|
|
// that depends on the current terminal settings
|
|
|
|
pub fn h_divider(divider string) string {
|
|
|
|
mut cols := 76
|
2020-01-28 20:25:17 +01:00
|
|
|
term_cols,_ := get_terminal_size()
|
2020-01-28 05:18:19 +01:00
|
|
|
if term_cols > 0 {
|
|
|
|
cols = term_cols
|
|
|
|
}
|
|
|
|
result := divider.repeat(1 + (cols / divider.len))
|
|
|
|
return result[0..cols]
|
|
|
|
}
|