From 823f6890b76385fbda395512af719935ed128f11 Mon Sep 17 00:00:00 2001 From: Alexander Guy Date: Wed, 2 Sep 2015 10:59:31 -0700 Subject: [PATCH] RunE commands should be considered runnable. --- command.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/command.go b/command.go index 5274082..71a484c 100644 --- a/command.go +++ b/command.go @@ -468,7 +468,7 @@ func (c *Command) execute(a []string) (err error) { return err } // If help is called, regardless of other flags, return we want help - // Also say we need help if c.Run is nil. + // Also say we need help if the command isn't runnable. helpVal, err := c.Flags().GetBool("help") if err != nil { // should be impossible to get here as we always declare a help @@ -843,7 +843,7 @@ func (c *Command) HasExample() bool { // Determine if the command is itself runnable func (c *Command) Runnable() bool { - return c.Run != nil + return c.Run != nil || c.RunE != nil } // Determine if the command has children commands