...

Source file src/github.com/mattn/go-tty/_example/readline.go

Documentation: github.com/mattn/go-tty/_example

     1  // +build ignore
     2  
     3  package main
     4  
     5  import (
     6  	"log"
     7  
     8  	"github.com/mattn/go-tty"
     9  	"github.com/mattn/go-tty/ttyutil"
    10  )
    11  
    12  func main() {
    13  	t, err := tty.Open()
    14  	if err != nil {
    15  		log.Fatal(err)
    16  	}
    17  	defer t.Close()
    18  
    19  	s, err := ttyutil.ReadLine(t)
    20  	if err != nil {
    21  		log.Fatal(err)
    22  	}
    23  	println(s)
    24  }
    25  

View as plain text