Making prefix matching opt in.

This commit is contained in:
spf13
2014-10-07 16:15:19 -04:00
parent c2c23ac0bd
commit b1e90a7943
3 changed files with 20 additions and 1 deletions

View File

@ -290,7 +290,7 @@ func (c *Command) Find(arrs []string) (*Command, []string, error) {
for _, cmd := range c.commands {
if cmd.Name() == argsWOflags[0] || cmd.HasAlias(argsWOflags[0]) { // exact name or alias match
return innerfind(cmd, argsMinusX(args, argsWOflags[0]))
} else {
} else if EnablePrefixMatching {
if strings.HasPrefix(cmd.Name(), argsWOflags[0]) { // prefix match
matches = append(matches, cmd)
}