File: termsize.go

package info (click to toggle)
golang-github-itchyny-go-flags 1.5.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 444 kB
  • sloc: sh: 17; makefile: 5
file content (15 lines) | stat: -rw-r--r-- 235 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// +build !windows,!plan9,!appengine,!wasm

package flags

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)
}