Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionFunc ¶
ActionFunc defines the signature of an action associated with a command. Actions take on parameter, a slice of strings, representing the arguments passed to the command. Actions should return a string representing the result of the action, or an error if the action fails.
type Command ¶
type Command struct { Name string Action ActionFunc Usage string }
Command is a command that can be registered with the REPL. It consists of a name, an action that is run when the name is input to the REPL, and a usage string.
type REPL ¶
type REPL struct {
// contains filtered or unexported fields
}
REPL is a read-eval-print loop used to create a simple, minimalistic, easy-to-use command line interface for masterkey, with an automatic timeout that exits the program after a specified duration.
func (*REPL) AddCommand ¶
AddCommand registers the command provided in `cmd` with the REPL.
func (*REPL) OnStop ¶
func (r *REPL) OnStop(sf func())
OnStop registers a function to be called when the REPL stops.