aboutsummaryrefslogtreecommitdiffstats
path: root/commands/commands.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/commands.go')
-rw-r--r--commands/commands.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/commands/commands.go b/commands/commands.go
index 2753686f..1aa8e1af 100644
--- a/commands/commands.go
+++ b/commands/commands.go
@@ -37,6 +37,13 @@ func (cmds *Commands) Names() []string {
return names
}
+func (cmds *Commands) ByName(name string) Command {
+ if cmd, ok := cmds.dict()[name]; ok {
+ return cmd
+ }
+ return nil
+}
+
func (cmds *Commands) Register(cmd Command) {
// TODO enforce unique aliases, until then, duplicate each
if len(cmd.Aliases()) < 1 {