toolbox/tui/util.go
2021-03-31 10:27:54 +02:00

24 lines
267 B
Go

package tui
import (
"os"
"golang.org/x/term"
)
func must(err error) {
if err != nil {
panic(err)
}
}
func TermSize() (w, h int) {
w, h, _ = term.GetSize(int(os.Stdin.Fd()))
return w, h
}
func mustWrite(buf []byte) {
_, err := t.Write(buf)
must(err)
}