From b3917f15b395a5dbc5f541aa98d60d954b5410f8 Mon Sep 17 00:00:00 2001 From: Chris Williams Date: Mon, 26 Feb 2018 10:52:51 -0800 Subject: [PATCH] Return an error if not runnable --- command.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/command.go b/command.go index 29675b33..d7d37ac1 100644 --- a/command.go +++ b/command.go @@ -17,6 +17,7 @@ package cobra import ( "bytes" + "errors" "fmt" "io" "os" @@ -713,7 +714,7 @@ func (c *Command) execute(a []string) (err error) { } if !c.Runnable() { - return flag.ErrHelp + return errors.New("Subcommand required.") } c.preRun()