mirror of https://github.com/spf13/cobra.git
provide usefull errors when using invalid sub command
This commit is contained in:
parent
10cf7be997
commit
140c5d89f1
|
@ -766,7 +766,10 @@ func (c *Command) Traverse(args []string) (*Command, []string, error) {
|
|||
|
||||
cmd := c.findNext(arg)
|
||||
if cmd == nil {
|
||||
return c, args, nil
|
||||
if c.Runnable() {
|
||||
return c, args, nil
|
||||
}
|
||||
return c, args, legacyArgs(c, args)
|
||||
}
|
||||
|
||||
if err := c.ParseFlags(flags); err != nil {
|
||||
|
|
Loading…
Reference in New Issue