From 140c5d89f19c4ce88b06dde2d6c3780d86608da3 Mon Sep 17 00:00:00 2001 From: Uwe Krueger Date: Thu, 2 Jun 2022 11:08:19 +0200 Subject: [PATCH] provide usefull errors when using invalid sub command --- command.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/command.go b/command.go index 6ff47dd5..5c0db8b1 100644 --- a/command.go +++ b/command.go @@ -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 {