Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Router ¶
type Router struct {
Routes *Leaf
}
Router routes a command string to a command.
func (*Router) AddCommand ¶
AddCommand adds command-string mapping
func (*Router) Route ¶
Route routes to handler from string. Returns the command and the number of matched args. e.g.
// r has a route through "example"->"command"->"string" com, ind := r.Route([]string{"example", "command", "string", "with", "args"})
`com` will contain the command at "string" leaf `ind` will be 3
func (*Router) ToSlice ¶
ToSlice searches the tree and populates a slice of Commands sorted by the first alias name
Duplicates are removed in case you were wondering
func (*Router) ToStringSlice ¶
ToStringSlice wraps ToSlice and populates a strings slice of aliases
Click to show internal directories.
Click to hide internal directories.