linenoise

package module
v0.0.0-...-d0290c8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2016 License: BSD-2-Clause Imports: 2 Imported by: 0

README

Go-Linenoise

2014-10-27可用

Go语言的linenoise包装,附带了原来所有的C源代码

My Golang binding of linenoise, with all C code inside and modified for go-callback

下载后,需要把目录名从go-linenoise手工改成linenosie,才能使用,切记切记

After Download, rename go-linenoise to linenoise, for install and use

Linenoise

或许很多人知道readline,一个命令行编辑库,Bash,Mysql,Mutt都在使用。Antirez(Redis的作者)编写了一个更加轻量级的行编辑库,只有一千多行,就实现了在命令行上移动、增删、复制、粘贴、搜索等功能,用于Redis/MongoDB/Andriod。

通过linenoise,你可以完成这些功能:

  • 上下方向键切换历史命令
  • ctrl+r 可以搜索历史命令,很常用的一个
  • ctrl+a 到行首
  • ctrl+e 到行尾
  • ctrl+u 删除到行首
  • ctrl+k 删除到行尾
  • ctrl+l 类似 clear 命令效果
  • ctrl+y 粘贴

Example

$ cd example
$ go build
$ ./example

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCompletion

func AddCompletion(lc unsafe.Pointer, completion string)

func ClearScreen

func ClearScreen()

func HistoryAdd

func HistoryAdd(line string) (done bool)

func HistoryLoad

func HistoryLoad(filename string)

func HistorySave

func HistorySave(filename string)

func HistorySetMaxLen

func HistorySetMaxLen(length int)

func PrintKeyCodes

func PrintKeyCodes()

func Scan

func Scan(prompt string) (line string, end bool)

func SetCompletionCallback

func SetCompletionCallback(fn CompletionCallback)

func SetMultiLine

func SetMultiLine(yes bool)

Types

type CompletionCallback

type CompletionCallback func(buf string, lc unsafe.Pointer)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL