bubbletea/tty_unix.go

29 lines
348 B
Go
Raw Normal View History

// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package tea
import (
"github.com/pkg/term"
)
var (
tty *term.Term
)
func initTerminal() error {
var err error
tty, err = term.Open("/dev/tty")
if err != nil {
return err
}
tty.SetRaw()
hideCursor()
return nil
}
func restoreTerminal() {
showCursor()
tty.Restore()
}