No description, website, or topics provided.
Go
Switch branches/tags
Nothing to show
Clone or download
Latest commit 931426f Feb 20, 2018
Permalink
Failed to load latest commit information.
_example fix example Feb 19, 2018
readline add ttyutil.ReadLine Jul 29, 2017
.travis.yml add .travis.yml Jun 4, 2016
README.md update README.md Feb 14, 2018
tty.go handle SIGWINCH Feb 19, 2018
tty_bsd.go first import Jun 3, 2016
tty_linux.go first import Jun 3, 2016
tty_plan9.go s/Inbuf/Buffered/g Jul 15, 2017
tty_unix.go fix build on UNIX Feb 19, 2018
tty_windows.go handle SIGWINCH Feb 19, 2018

README.md

go-tty

Simple tty utility

Usage

tty, err := tty.Open()
if err != nil {
	log.Fatal(err)
}
defer tty.Close()

for {
	r, err := tty.ReadRune()
	if err != nil {
		log.Fatal(err)
	}
	// handle key event
}

if you are on windows and want to display ANSI colors, use go-colorable.

tty, err := tty.Open()
if err != nil {
	log.Fatal(err)
}
defer tty.Close()

out := colorable.NewColorable(tty.Output())

fmt.Fprintln(out, "\x1b[2J")

Installation

$ go get github.com/mattn/go-tty

License

MIT

Author

Yasuhiro Matsumoto (a.k.a mattn)