mirror of
https://github.com/spf13/cobra
synced 2025-05-06 05:17:21 +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 (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
@ -713,7 +714,7 @@ func (c *Command) execute(a []string) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !c.Runnable() {
|
if !c.Runnable() {
|
||||||
return flag.ErrHelp
|
return errors.New("Subcommand required.")
|
||||||
}
|
}
|
||||||
|
|
||||||
c.preRun()
|
c.preRun()
|
||||||
|
|
Loading…
Add table
Reference in a new issue