regolancer/helpmessage/termsize.go
2022-11-14 01:19:59 +01:00

17 lines
294 B
Go

//go:build !windows && !plan9 && !appengine && !wasm
// +build !windows,!plan9,!appengine,!wasm
package helpmessage
import (
"golang.org/x/sys/unix"
)
func getTerminalColumns() int {
ws, err := unix.IoctlGetWinsize(0, unix.TIOCGWINSZ)
if err != nil {
return 80
}
return int(ws.Col)
}