Documentation
¶
Index ¶
- Variables
- func HandleCommand(cmd *Command) (string, error)
- func HandleCommandLine(line string, actor Actor) (string, error)
- func Register(name Name, description string, permission Permission, handler Handler)
- func RegisterDefinition(def Definition)
- type Actor
- type Command
- type Definition
- type Handler
- type HandlerFunc
- type Name
- type Permission
- type Registry
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUnknownCommand = errors.New("unknown command") ErrPermissionDenied = errors.New("permission denied") )
View Source
var Default = NewRegistry()
Functions ¶
func HandleCommand ¶
func Register ¶
func Register(name Name, description string, permission Permission, handler Handler)
func RegisterDefinition ¶
func RegisterDefinition(def Definition)
Types ¶
type Actor ¶
type Actor interface {
HasPermission(Permission) bool
}
type Command ¶
func NewCommand ¶
type Definition ¶
type Definition struct { Name Description string Permission Handler }
type HandlerFunc ¶
func (HandlerFunc) HandleCommand ¶
func (f HandlerFunc) HandleCommand(cmd *Command) (string, error)
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) Register ¶
func (r *Registry) Register(name Name, description string, permission Permission, handler Handler)
func (*Registry) RegisterDefinition ¶
func (r *Registry) RegisterDefinition(def Definition)
Click to show internal directories.
Click to hide internal directories.