diff options
Diffstat (limited to 'commands/commands.go')
-rw-r--r-- | commands/commands.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/commands/commands.go b/commands/commands.go index e87cd802..a06e8ef9 100644 --- a/commands/commands.go +++ b/commands/commands.go @@ -53,6 +53,7 @@ func CurrentContext() CommandContext { } type Command interface { + Description() string Context() CommandContext Aliases() []string Execute([]string) error @@ -75,8 +76,14 @@ func Register(cmd Command) { func ActiveCommands() []Command { var cmds []Command context := CurrentContext() + seen := make(map[reflect.Type]bool) for _, cmd := range allCommands { + t := reflect.TypeOf(cmd) + if seen[t] { + continue + } + seen[t] = true if cmd.Context()&context != 0 { cmds = append(cmds, cmd) } |