lined

package module
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: BSD-3-Clause Imports: 9 Imported by: 1

README

linED

Overview

This package provides an editable input buffer from an ANSI compatible terminal. The editor supports lines longer than the terminal width.

Automated documentation for this Go package is available from Go Reference.

License info

The lined package is distributed with the same BSD 3-clause license as that used by golang itself.

Reporting bugs and feature requests

Use the github lined bug tracker.

Documentation

Overview

Package lined provides an interactive text line reading interface for compatible terminals.

The code uses escape sequences mostly from this list: https://en.wikipedia.org/wiki/ANSI_escape_code. However, in addition, it also uses some shortcuts found in Bash and Emacs.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoReader   = errors.New("no reader defined")
	ErrTerminated = errors.New("program terminated")
	ErrEOF        = errors.New("end of file")
)

ErrNoReader is the error return for a *Reader being nil.

Functions

This section is empty.

Types

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader implements a line string reader.

func NewReader

func NewReader() *Reader

NewReader returns a new Reader that sources its data from os.Stdin allowing editing visible via os.Stdout.

func (*Reader) History

func (r *Reader) History(n int) (string, int)

History returns a recent line of input read from the Reader. This function returns the nth most recent line content and the total number of lines of history so far recorded.

func (*Reader) ReadPassword

func (r *Reader) ReadPassword() (string, error)

ReadPassword reads a whole line of input, but does not echo the input on os.Stdout and neither adds the input to the history nor supports access to history while entering the text of the line.

func (*Reader) ReadString

func (r *Reader) ReadString() (string, error)

ReadString reads a whole line of input in the form of a string. Unlike the bufio.Reader implementation, no delim is required since lines are expected to end "\n". This function allows visual editing of the line using supported escape sequences.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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