mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Declare kubectl validate flag once
This commit is contained in:
		@@ -167,6 +167,12 @@ func (f *Factory) BindFlags(flags *pflag.FlagSet) {
 | 
			
		||||
	// pflags currently.  See https://github.com/spf13/cobra/issues/44.
 | 
			
		||||
	util.AddPFlagSetToPFlagSet(pflag.CommandLine, flags)
 | 
			
		||||
 | 
			
		||||
	// Hack for global access to validation flag.
 | 
			
		||||
	// TODO: Refactor out after configuration flag overhaul.
 | 
			
		||||
	if f.flags.Lookup("validate") == nil {
 | 
			
		||||
		f.flags.Bool("validate", false, "If true, use a schema to validate the input before sending it")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if f.flags != nil {
 | 
			
		||||
		f.flags.VisitAll(func(flag *pflag.Flag) {
 | 
			
		||||
			flags.AddFlag(flag)
 | 
			
		||||
@@ -178,14 +184,6 @@ func (f *Factory) BindFlags(flags *pflag.FlagSet) {
 | 
			
		||||
	// TODO Add a verbose flag that turns on glog logging. Probably need a way
 | 
			
		||||
	// to do that automatically for every subcommand.
 | 
			
		||||
	flags.BoolVar(&f.clients.matchVersion, FlagMatchBinaryVersion, false, "Require server version to match client version")
 | 
			
		||||
 | 
			
		||||
	flags.Bool("validate", false, "If true, use a schema to validate the input before sending it")
 | 
			
		||||
 | 
			
		||||
	// Hack for global access to validation flag.
 | 
			
		||||
	// TODO: Refactor out after configuration flag overhaul.
 | 
			
		||||
	if f.flags.Lookup("validate") == nil {
 | 
			
		||||
		f.flags.Bool("validate", false, "If true, use a schema to validate the input before sending it")
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewKubectlCommand creates the `kubectl` command and its nested children.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user