Documentation ¶
Overview ¶
Package debugstream provides an interface for custom debug commands to assist in program development.
Index ¶
- func AddCommand(c Command) error
- func AddDefaultsForScope(scopeID int32, controller interface{})
- func AttachToStream(ctx context.Context, input io.Reader, output io.Writer)
- type Command
- type ScopedCommands
- func (sc *ScopedCommands) AddCommand(c Command) error
- func (sc *ScopedCommands) AddDefaultsForScope(scopeID int32, controller window.Window)
- func (sc *ScopedCommands) AttachToStream(ctx context.Context, input io.Reader, out io.Writer)
- func (sc *ScopedCommands) ClearCommand(scopeID int32, s string)
- func (sc *ScopedCommands) CommandsInScope(scope int32, showUsage bool) []string
- func (sc *ScopedCommands) RemoveScope(scope int32)
- func (sc *ScopedCommands) ResetCommands()
- func (sc *ScopedCommands) ResetCommandsForScope(scope int32)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCommand ¶
AddCommand to the default command set. See ScopedCommands' AddComand.
func AddDefaultsForScope ¶
func AddDefaultsForScope(scopeID int32, controller interface{})
AddDefaultsForScope for debugging.
Types ¶
type Command ¶
type Command struct { Name string ScopeID int32 Operation func([]string) string // the actual operation to execute Usage string // usage string, print when 'help' is called Force bool // replace any existing command by this name }
Command is a local format for performing these debug stream things.
type ScopedCommands ¶
ScopedCommands for the debug stream commands. Contains a set of scopes that align with oak.Controller. Currently can only be attached to a single stream
var ( // DefaultCommands to attach to. DefaultCommands *ScopedCommands )
func NewScopedCommands ¶
func NewScopedCommands() *ScopedCommands
NewScopedCommands creates set of standard help functions.
func (*ScopedCommands) AddCommand ¶
func (sc *ScopedCommands) AddCommand(c Command) error
AddCommand adds a console command to call fn when '<s> <args>' is input to the console. fn will be called with args split on whitespace.
func (*ScopedCommands) AddDefaultsForScope ¶
func (sc *ScopedCommands) AddDefaultsForScope(scopeID int32, controller window.Window)
AddDefaultsForScope for debugging.
func (*ScopedCommands) AttachToStream ¶
AttachToStream and start executing the registered commands on input to said stream. Currently a given set of scoped commands may be attached once and only once. It will stop parsing commands when the provided context is done.
func (*ScopedCommands) ClearCommand ¶
func (sc *ScopedCommands) ClearCommand(scopeID int32, s string)
ClearCommand clears an existing debug command for scope with key: <s>
func (*ScopedCommands) CommandsInScope ¶
func (sc *ScopedCommands) CommandsInScope(scope int32, showUsage bool) []string
CommandsInScope returns the current debug console commands as a string array
func (*ScopedCommands) RemoveScope ¶
func (sc *ScopedCommands) RemoveScope(scope int32)
RemoveScope from the command set. Usually done on the close of a scope.
func (*ScopedCommands) ResetCommands ¶
func (sc *ScopedCommands) ResetCommands()
ResetCommands will throw out all existing debug commands from the debug console.
func (*ScopedCommands) ResetCommandsForScope ¶
func (sc *ScopedCommands) ResetCommandsForScope(scope int32)
ResetCommandsForScope will throw out all existing debug commands from the debug console for hte given scope.