vendor/github.com/spf13/cobra/flag_groups.go
changeset 265 05c40b36d3b2
parent 260 445e01aede7e
equal deleted inserted replaced
264:8f478162d991 265:05c40b36d3b2
     1 // Copyright © 2022 Steve Francia <spf@spf13.com>.
     1 // Copyright 2013-2022 The Cobra Authors
     2 //
     2 //
     3 // Licensed under the Apache License, Version 2.0 (the "License");
     3 // Licensed under the Apache License, Version 2.0 (the "License");
     4 // you may not use this file except in compliance with the License.
     4 // you may not use this file except in compliance with the License.
     5 // You may obtain a copy of the License at
     5 // You may obtain a copy of the License at
     6 // http://www.apache.org/licenses/LICENSE-2.0
     6 //
       
     7 //      http://www.apache.org/licenses/LICENSE-2.0
     7 //
     8 //
     8 // Unless required by applicable law or agreed to in writing, software
     9 // Unless required by applicable law or agreed to in writing, software
     9 // distributed under the License is distributed on an "AS IS" BASIS,
    10 // distributed under the License is distributed on an "AS IS" BASIS,
    10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    11 // See the License for the specific language governing permissions and
    12 // See the License for the specific language governing permissions and
    56 			panic(err)
    57 			panic(err)
    57 		}
    58 		}
    58 	}
    59 	}
    59 }
    60 }
    60 
    61 
    61 // validateFlagGroups validates the mutuallyExclusive/requiredAsGroup logic and returns the
    62 // ValidateFlagGroups validates the mutuallyExclusive/requiredAsGroup logic and returns the
    62 // first error encountered.
    63 // first error encountered.
    63 func (c *Command) validateFlagGroups() error {
    64 func (c *Command) ValidateFlagGroups() error {
    64 	if c.DisableFlagParsing {
    65 	if c.DisableFlagParsing {
    65 		return nil
    66 		return nil
    66 	}
    67 	}
    67 
    68 
    68 	flags := c.Flags()
    69 	flags := c.Flags()