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

View file

@ -766,8 +766,11 @@ func (c *Command) Traverse(args []string) (*Command, []string, error) {
cmd := c.findNext(arg)
if cmd == nil {
if c.Runnable() {
return c, args, nil
}
return c, args, legacyArgs(c, args)
}
if err := c.ParseFlags(flags); err != nil {
return nil, args, err