Ignore required flags when DisableFlagParsing (#1095)
When a command request to DisableFlagParsing, it should not fail due to a missing required flag. In fact, such a check will always fail since flags weren't parsed! Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
This commit is contained in:
@ -979,6 +979,10 @@ func (c *Command) ValidateArgs(args []string) error {
|
||||
}
|
||||
|
||||
func (c *Command) validateRequiredFlags() error {
|
||||
if c.DisableFlagParsing {
|
||||
return nil
|
||||
}
|
||||
|
||||
flags := c.Flags()
|
||||
missingFlagNames := []string{}
|
||||
flags.VisitAll(func(pflag *flag.Flag) {
|
||||
|
Reference in New Issue
Block a user