Documentation
¶
Overview ¶
Package textcmd implements a simple text command shell and executor.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrCmdNotFound = errors.New("command not found") ErrCmdQuit = errors.New("quit command") )
Errors.
Functions ¶
This section is empty.
Types ¶
type History ¶ added in v1.1.0
type History struct {
// contains filtered or unexported fields
}
History tracks command history with readline-style cursor navigation. It is per-session state and is not tied to a Shell.
func NewHistory ¶ added in v1.1.0
NewHistory creates a new History. max limits the number of entries kept; max <= 0 means unbounded.
func (*History) Add ¶ added in v1.1.0
Add appends a command to the history and resets the cursor to the end. Empty/whitespace-only strings and consecutive duplicates are skipped.
func (*History) Next ¶ added in v1.1.0
Next moves the cursor forward and returns the entry. Returns "" when moving past the last entry.
type Shell ¶
type Shell struct {
// contains filtered or unexported fields
}
Shell is a text command shell for which commands can be registered and executed.
func (Shell) Complete ¶ added in v1.1.0
Complete returns the input expanded as far as possible and all possible full command strings.