-
Notifications
You must be signed in to change notification settings - Fork 0
Home
func TerminalMode() (ModeApplier, error)
KillRingMax is the max number of elements to save on the killring.
const KillRingMax = 60ErrCloseChannel is returned when a channel is closed unexpectedly
var ErrCloseChannel = errors.New("channel is closed")ErrNotTerminalOutput is returned from Prompt or PasswordPrompt if the platform is normally supported, but stdout has been redirected
var ErrNotTerminalOutput = errors.New("standard output is not a terminal")ErrPromptAborted is returned from Prompt or PasswordPrompt when the user presses Ctrl-C if SetCtrlCAborts(true) has been called on the State
var ErrPromptAborted = errors.New("prompt aborted")ErrZeroColumns is returned if the number of colums becomes zero during an active call to Prompt
var ErrZeroColums = errors.New("number of colums is zero")func TerminalSupported() boolTerminalSupported returns true if the current terminal supports line editing features, and false if liner will use the 'dumb' fallback for input. Note that TerminalSupported does not check all factors that may cause liner to not fully support the terminal (such as stdin redirection)
func NewLiner() *StateNewLiner initializes a new *State, and sets the terminal into raw mode. To restore the terminal to its previous state, call State.Close().
type ModeApplier interface {
ApplyMode() error
}ModeApplier is the interface that wraps a representation of the terminal mode. ApplyMode sets the terminal to this mode.
func TerminalMode() (ModeApplier, error)TerminalMode returns the current terminal input mode as an InputModeSetter.
This function is provided for convenience, and should not be necessary for most users of liner.
type ShouldRestart func(err error) boolShouldRestart is passed the error generated by readNext and returns true if the the read should be restarted or false if the error should be returned.
type State struct {
// contains filtered or unexported fields
}State represents an open terminal
func (s *State) Close() errorClose returns the terminal to its previous mode
func (s *State) PrefilledInput(text string, pos int) (string, error)PrefilledInput displays an editable text field with cursor at given position. The cursor will be set to the end of the line if given position is negative or greater than length of text (in runes). Returns a line of user input, not including a trailing newline character. An io.EOF error is returned if the user signals end-of-file by pressing Ctrl-D.