MCPcopy Index your code
hub / github.com/mattn/go-tty

github.com/mattn/go-tty @v2.0.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.0.2 ↗ · + Follow
71 symbols 134 edges 11 files 2 documented · 3% 22 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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/v2

License

MIT

Author

Yasuhiro Matsumoto (a.k.a mattn)

Core symbols most depended-on inside this repo

Close
called by 7
tty.go
Output
called by 7
tty.go
ReadRune
called by 6
tty.go
Buffered
called by 4
tty.go
readString
called by 4
tty.go
open
called by 2
tty_unix.go
readRune
called by 2
tty_unix.go
size
called by 2
tty_unix.go

Shape

Method 43
Struct 14
Function 10
TypeAlias 4

Languages

Go100%

Modules by API surface

tty_windows.go26 symbols
tty.go18 symbols
tty_unix.go12 symbols
tty_plan9.go9 symbols
ttyutil/readline.go3 symbols
_example/simple.go1 symbols
_example/readline.go1 symbols
_example/password.go1 symbols

For agents

$ claude mcp add go-tty \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page