mirror of
https://github.com/spf13/cobra
synced 2025-05-05 21:07:24 +00:00
Return an error if not runnable
This commit is contained in:
parent
a1e4933ab7
commit
b3917f15b3
1 changed files with 2 additions and 1 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Reference in a new issue