This repository has been archived on 2021-03-25. You can view files and clone it, but cannot push or open issues/pull-requests.
tui/util.go

24 lines
269 B
Go

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