Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CommandHandler ¶
CommandHandler is a function that handles a meta command.
type CommandResult ¶ added in v0.1.2
type CommandResult struct {
Text string // Plain text output
HTML string // HTML output (if non-empty, sent as text/html)
}
CommandResult holds the output of a meta command with optional MIME type.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds registered meta commands.
func NewRegistry ¶
NewRegistry creates a new command registry with default commands.
func (*Registry) Register ¶
func (r *Registry) Register(name, description string, handler CommandHandler)
Register adds a command to the registry.
func (*Registry) RegisterRich ¶ added in v0.1.2
func (r *Registry) RegisterRich(name, description string, handler RichCommandHandler)
RegisterRich adds a rich command (with HTML support) to the registry.
type RichCommandHandler ¶ added in v0.1.2
type RichCommandHandler func(ctx context.Context, args []string) (*CommandResult, error)
RichCommandHandler returns a CommandResult with optional HTML output.
Click to show internal directories.
Click to hide internal directories.