Clone this repo:
  1. acb06aa Delete renovate.json by mattn · 9 months ago master
  2. 3f926a3 Merge pull request #33 from mattn/renovate/github.com-mattn-go-runewidth-0.x by mattn · 10 months ago
  3. ddf5c80 Update module mattn/go-runewidth to v0.0.7 by Renovate Bot · 10 months ago
  4. 8ae152e Merge pull request #30 from mattn/renovate/configure by mattn · 10 months ago
  5. 3469806 Add renovate.json by Renovate Bot · 10 months ago

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)