24 lines
267 B
Go
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)
|
|
}
|