Skip to content
Myr

Expose ValidateRequiredFlags and ValidateFlagGroups (#1760)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Skeet WU · committed by GitHub · parent a281c8b · Browse files · 2 files+6 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+6 added−5 removed

  • other:+6 added−5 removed

2 files+6 added−5 removed

modified:command.go+4 added-3 removed
860 unmodified lines
861 } else if c.PreRun != nil {862 c.PreRun(c, argWoFlags)863 }864865 if err := c.validateRequiredFlags(); err != nil {865 if err := c.ValidateRequiredFlags(); err != nil {866 return err867 }868 if err := c.validateFlagGroups(); err != nil {868 if err := c.ValidateFlagGroups(); err != nil {869 return err870 }871872 if c.RunE != nil {
145 unmodified lines
1018 }1019 return c.Args(c, args)1020}10211022// ValidateRequiredFlags validates all required flags are present and returns an error otherwise1022func (c *Command) validateRequiredFlags() error {1023func (c *Command) ValidateRequiredFlags() error {1024 if c.DisableFlagParsing {1025 return nil1026 }1027
683 unmodified lines
modified:flag_groups.go+2 added-2 removed
57 unmodified lines
58 }59 }60}6162// validateFlagGroups validates the mutuallyExclusive/requiredAsGroup logic and returns the62// ValidateFlagGroups validates the mutuallyExclusive/requiredAsGroup logic and returns the63// first error encountered.64func (c *Command) validateFlagGroups() error {64func (c *Command) ValidateFlagGroups() error {65 if c.DisableFlagParsing {66 return nil67 }68
156 unmodified lines