GNU-Readline類型的一個Go實現:readline

jopen 9年前發布 | 14K 次閱讀 readline Google Go/Golang開發
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

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)
}

項目主頁:http://www.baiduhome.net/lib/view/home/1443275514732

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!