provide usefull errors when using invalid sub command

This commit is contained in:
Uwe Krueger 2022-06-02 11:08:19 +02:00
parent 10cf7be997
commit 140c5d89f1
1 changed files with 4 additions and 1 deletions

View File

@ -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 {