File: readline.go

package info (click to toggle)
golang-github-mattn-go-tty 0.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 128 kB
  • sloc: makefile: 3
file content (24 lines) | stat: -rw-r--r-- 287 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// +build ignore

package main

import (
	"log"

	"github.com/mattn/go-tty"
	"github.com/mattn/go-tty/ttyutil"
)

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

	s, err := ttyutil.ReadLine(t)
	if err != nil {
		log.Fatal(err)
	}
	println(s)
}