is there any way to get terminal width in v?

224 views Asked by At

is There any way to get terminal width in V language? I want to get terminal size (or just columns). this is my code:

fn get_terminal_width() int {
    // help me
}
fn main() {
    width := get_terminal_width() - 5
    for _ in 0 .. width {
        print('=')
    }
    println('done')
}
1

There are 1 answers

0
Enzo Baldisserri On BEST ANSWER

You can use term.get_terminal_size().

You can check out the documentation here (even if it is pretty empty for the moment): https://modules.vlang.io/term.html#get_terminal_size