commit | 58e62bdc672704a1f45711b1f3404a301d62ef89 | [log] [tgz] |
---|---|---|
author | Yasuhiro Matsumoto <[email protected]> | Mon Jul 22 13:37:52 2024 |
committer | Yasuhiro Matsumoto <[email protected]> | Mon Jul 22 13:38:33 2024 |
tree | b2c46a23cc0b32fcf41c7a6b579c5862aa9ed640 | |
parent | ad1411c003400622b590f4dc952e0c25725a31f8 [diff] |
upgrade
Simple tty utility
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")
$ go get github.com/mattn/go-tty
MIT
Yasuhiro Matsumoto (a.k.a mattn)