Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct {
// Name is the command's unique name, used to identify it. Spaces aren't
// supported.
Name string
// Aliases are optional additional names that can be used to refer to the
// command. Spaces aren't supported.
Aliases []string
// Run is the command's main method, executed when the command is called
// with valid arguments.
Run func(p Prompt, args []string)
// ValidateArgs is an optional function to validate a command's arguments
// before being run.
ValidateArgs func(p Prompt, args []string) (ok bool)
// Desc is the command's shortest description. Desc is displayed when using
// the builtin 'help' command to display the command list.
Desc string
// Usage is the command's usage string. If provided, it will be displayed
// when using 'help <cmd>'
Usage string
// Help is the command's long string. If provided, it will be displayed when
// using 'help <cmd>'
Help string
}
Command represents a command of the interactive debugger.
type Prompt ¶
type Prompt interface {
Printf(format string, a ...interface{})
Println(a ...interface{})
Readline() string
ReadPassword() string
Clear()
}
Prompt represents a prompt with which the user interacts.
The Prompt is responsible both for reading user input as well as outputing back to the user. Each Shell holds a reference to a single Prompt, used to read commands and arguments from the user. Additionally, the same Prompt is passed to each command for user interaction capabilities.
type Shell ¶
type Shell struct {
// contains filtered or unexported fields
}
Shell represents an interactive shell, holding a list of given commands.
func NewWithPrompt ¶
NewWithPrompt returns a Shell with a specified Prompt.
type TerminalPrompt ¶
type TerminalPrompt struct {
// contains filtered or unexported fields
}
TerminalPrompt is a simple terminal Prompt implementation.
func NewTerminalPrompt ¶
func NewTerminalPrompt(prompt string, l *liner.State) *TerminalPrompt
func (*TerminalPrompt) Clear ¶
func (t *TerminalPrompt) Clear()
func (*TerminalPrompt) Printf ¶
func (t *TerminalPrompt) Printf(format string, a ...interface{})
func (*TerminalPrompt) Println ¶
func (t *TerminalPrompt) Println(a ...interface{})
func (*TerminalPrompt) ReadPassword ¶
func (t *TerminalPrompt) ReadPassword() string
func (*TerminalPrompt) Readline ¶
func (t *TerminalPrompt) Readline() string
Click to show internal directories.
Click to hide internal directories.