diff --git a/commands/command.go b/commands/command.go index 5db0eb9e3..449ce2aa6 100644 --- a/commands/command.go +++ b/commands/command.go @@ -91,6 +91,14 @@ func (c *Command) Resolve(path []string) ([]*Command, error) { return cmds, nil } +func (c *Command) Get(path []string) (*Command, error) { + cmds, err := c.Resolve(path) + if err != nil { + return nil, err + } + return cmds[len(cmds) - 1], nil +} + // GetOptions gets the options in the given path of commands func (c *Command) GetOptions(path []string) (map[string]Option, error) { options := make([]Option, len(c.Options))