Naveen Sampath | 04696f7 | 2022-06-13 15:19:14 +0530 | [diff] [blame] | 1 | // +build !windows,!plan9,!appengine,!wasm |
2 | |||||
3 | package flags | ||||
4 | |||||
5 | import ( | ||||
6 | "golang.org/x/sys/unix" | ||||
7 | ) | ||||
8 | |||||
9 | func getTerminalColumns() int { | ||||
10 | ws, err := unix.IoctlGetWinsize(0, unix.TIOCGWINSZ) | ||||
11 | if err != nil { | ||||
12 | return 80 | ||||
13 | } | ||||
14 | return int(ws.Col) | ||||
15 | } |