readline

package module
v0.0.0-...-852e0b4 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2018 License: BSD-3-Clause Imports: 5 Imported by: 8

README

go-readline

go-readline is a wrapper for the GNU Readline library for the Go programming language.

This repository contains work from multiple contributors. See the AUTHORS file for details.

Requirements

go-readline requires Go 1.2 or newer. Download the latest from: https://code.google.com/p/go/downloads/

Git is required for installing via go get.

A C compiler (gcc or clang) and the GNU Readline library are required too.

On Debian and Ubuntu, install the development packages:

apt-get install build-essential libreadline-dev

On CentOS and RHEL:

yum install gcc readline-devel

On Mac OS X, via homebrew:

brew install readline
Installation

Make sure $GOROOT and $GOPATH are set, and install:

go get github.com/fiorix/go-readline

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCompleter func(string, string, int, int) []string
View Source
var (
	HistoryLength = -1 // Maximum number of lines in the history file.
)

Functions

func AddHistory

func AddHistory(s string)

AddHistory adds a string to the end of the history list.

func GetCompleterDelims

func GetCompleterDelims() string

GetCompleterDemils gets current word delimiters for tab-completion.

func LineBuffer

func LineBuffer() string

LineBuffer returns the line gathered so far.

func ParseAndBind

func ParseAndBind(s string)

ParseAndBind parses line as if it had been read from the inputrc file and performs any key bindings and variable assignments found.

func ProcessCompletion

func ProcessCompletion(textC *C.char, lineC *C.char, start, end int) **C.char

func ReadHistoryFile

func ReadHistoryFile(s string) error

ReadHistory loads a readline history file. The default filename is ~/.history.

func ReadInitFile

func ReadInitFile(filename string) error

ReadInitFile reads keybindings and variable assignments from filename. The default filename is the last filename used.

func Readline

func Readline(prompt *string) *string

Readline prints the prompt and reads a line from the standard input.

func ResizeTerminal

func ResizeTerminal()

ResizeTerminal updates the internal screen size by reading values from the kernel.

func SetCompleterDelims

func SetCompleterDelims(break_chars string)

SetCompleterDelims sets the word delimiters for tab-completion.

func SetCompletionFunction

func SetCompletionFunction(c func(string, string, int, int) []string)

SetCompletionFunction sets the function that will be used when the user invokes completion.

The four arguments received by the function are:

  • The current word being matched, up to the cursor
  • The entire line
  • The begining of the current word
  • The end of the current word

func WriteHistoryFile

func WriteHistoryFile(s string) error

WriteHistory saves a readline history file. The default filename is ~/.history.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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