| commit | 51197a827c8539a740626ee8c45bd9950e411ccf | [log] [tgz] |
|---|---|---|
| author | mattn <mattn.jp@gmail.com> | Sat May 06 05:13:55 2023 |
| committer | GitHub <noreply@github.com> | Sat May 06 05:13:55 2023 |
| tree | 50f8c97bfa248fce9ea9478fd54945147dfa7706 | |
| parent | 6774b912f4aabfc7c78e3af775037ea10dc62784 [diff] | |
| parent | 085476bdb4d2e9c8d764892c2e83f1ffd6d0efab [diff] |
Merge pull request #47 from hymkor/fork20230506 Numbers of columns and lines were swapped at not Windows-OS
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)