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 ¶
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 ¶
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 ¶
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 ¶
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.