mirror of
https://github.com/spf13/cobra
synced 2025-05-05 04:47:22 +00:00
Use FlagErrorFunc for validateRequiredFlags and validateFlagGroups
This let's handle all flag errors and decide how to print them on the fly
This commit is contained in:
parent
ca8e3c2779
commit
5c62c6a057
1 changed files with 2 additions and 2 deletions
|
@ -861,10 +861,10 @@ func (c *Command) execute(a []string) (err error) {
|
|||
}
|
||||
|
||||
if err := c.validateRequiredFlags(); err != nil {
|
||||
return err
|
||||
return c.FlagErrorFunc()(c, err)
|
||||
}
|
||||
if err := c.validateFlagGroups(); err != nil {
|
||||
return err
|
||||
return c.FlagErrorFunc()(c, err)
|
||||
}
|
||||
|
||||
if c.RunE != nil {
|
||||
|
|
Loading…
Add table
Reference in a new issue