Documentation ¶
Index ¶
Constants ¶
const ( KEY_CTRL_C = "\x03" KEY_CTRL_D = "\x04" KEY_CTRL_L = "\x0C" KEY_TAB = "\x09" KEY_ENTER = "\x0D" KEY_CTRL_R = "\x12" KEY_CTRL_T = "\x14" KEY_ESCAPE = "\x1B" KEY_BACKSPACE = "\x7F" KEY_DEL = "\x1B[3~" KEY_END = "\x1B[F" KEY_HOME = "\x1B[H" KEY_UP_ARROW = "\x1B[A" KEY_DOWN_ARROW = "\x1B[B" KEY_RIGHT_ARROW = "\x1B[C" KEY_LEFT_ARROW = "\x1B[D" )
Variables ¶
var CODE_RESET = "\033[0m"
var EscapeFinder = regexp.MustCompile("\033\\[[^m]+m")
Functions ¶
This section is empty.
Types ¶
type AutoComplete ¶
type AutoComplete struct {
Name string
}
type Completer ¶
type Completer func(beforeCursor string, afterCursor string, full string) []*AutoComplete
Completer receives a string of everything before the cursor, after the cursor, and the entire command string. It returns a list of potential suggestions according to the available command set. Completers are invoked when the user presses <tab>, the completion key.
type History ¶
type History struct {
// contains filtered or unexported fields
}
func NewHistory ¶
NewHistory creates a new history object with optional pre-loaded history
func (*History) FindMostRecentMatch ¶ added in v0.1.2
FindMostRecentMatch returns the most recent command that contains subString, or an empty string
type LineReader ¶
type LineReader struct {
// contains filtered or unexported fields
}
func NewLineReader ¶
func NewLineReader(completer Completer, resizeChan chan os.Signal, nilShell *NilShell) *LineReader
NewLineReader creates a new LineReader object
type NilShell ¶
type NilShell struct { Prompt string History *History AutoCompleteLimit int // Maximum number of autocompletes to display Debug bool AutoCompleteSuggestStyle string AutoCompleteTooMuchStyle string // contains filtered or unexported fields }
func (*NilShell) Clear ¶
func (n *NilShell) Clear()
Clear will clear the terminal - this can be safely invoked in an OnExecute method to implement a clear command
func (*NilShell) ReadUntilTerm ¶
ReadUntilTerm blocks, receiving commands until the user requests termination. Commands are processed via the executor callback provided at initialization time. Likewise for command completion.
type ProcessingCode ¶
type ProcessingCode int8
const ( CodeContinue ProcessingCode = iota CodeComplete CodeCancel CodeTerminate )