1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/term/misc.v

16 lines
352 B
V
Raw Normal View History

2020-01-28 07:18:19 +03: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
term_cols, _ := get_terminal_size()
if term_cols > 0 {
cols = term_cols
}
result := divider.repeat(1 + (cols / divider.len))
return result[0..cols]
}