term/utils.go (view raw)
1package term 2 3import ( 4 "golang.org/x/sys/unix" 5) 6 7func GetSize() (width, height int, err error) { 8 size, err := unix.IoctlGetWinsize(0, unix.TIOCGWINSZ) 9 return int(size.Col), int(size.Row), err 10}