GNU-Readline类型的一个Go实现:readline
jopen
9年前
Readline是GNU-Readline 类型库的一个纯go(golang)实现。
Readline is A Pure Go Implementation of a libreadline-style Library.
The goal is to be a powerful alternater for GNU-Readline.
WHY: Readline will support most of features which GNU Readline is supported, and provide a pure go environment and a MIT license.
Demo
You can read the source code in example/main.go.
Todo
- Vim mode
- Transpose words
- More funny examples
Usage
- Simplest example
import "github.com/chzyer/readline" rl, err := readline.New("> ") if err != nil { panic(err) } defer rl.Close() for { line, err := rl.Readline() if err != nil { // io.EOF break } println(line) }