Return an error if not runnable

This commit is contained in:
Chris Williams 2018-02-26 10:52:51 -08:00
parent a1e4933ab7
commit b3917f15b3

View file

@ -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()