mirror of
https://github.com/spf13/cobra
synced 2025-05-05 04:47:22 +00:00
run either preRun or preRunE
This commit is contained in:
parent
ad45c7fb08
commit
101498514a
1 changed files with 6 additions and 4 deletions
10
command.go
10
command.go
|
@ -830,12 +830,14 @@ func (c *Command) execute(a []string) (err error) {
|
|||
return flag.ErrHelp
|
||||
}
|
||||
|
||||
if err := c.preRunE(); err != nil {
|
||||
return err
|
||||
if len(initializersE) > 0 {
|
||||
if err := c.preRunE(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
c.preRun()
|
||||
}
|
||||
|
||||
c.preRun()
|
||||
|
||||
argWoFlags := c.Flags().Args()
|
||||
if c.DisableFlagParsing {
|
||||
argWoFlags = a
|
||||
|
|
Loading…
Add table
Reference in a new issue