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
Raw Normal View History

2021-03-24 11:21:06 +00:00
package tui
import (
"os"
"golang.org/x/term"
)
func must(err error) {
if err != nil {
panic(err)
}
}
2021-03-24 11:34:41 +00:00
func WindowSize() (w, h int) {
2021-03-24 11:21:06 +00:00
w, h, _ = term.GetSize(int(os.Stdin.Fd()))
return w, h
}
func mustWrite(buf []byte) {
_, err := t.Write(buf)
must(err)
}