func FromFlags(progName string, args []string) (Config, string, error) {
	var schemaLocationsParam, ignoreFilenamePatterns arrayParam
	var skipKindsCSV, rejectKindsCSV string
	flags := flag.NewFlagSet(progName, flag.ExitOnError)
	var buf bytes.Buffer
	flags.SetOutput(&buf)

	c := Config{}
	c.Files = []string{}

	flags.StringVar(&c.KubernetesVersion, "kubernetes-version", "master", "version of Kubernetes to validate against, e.g.: 1.18.0")
	flags.Var(&schemaLocationsParam, "schema-location", "override schemas location search path (can be specified multiple times)")
	flags.StringVar(&skipKindsCSV, "skip", "", "comma-separated list of kinds to ignore")
	flags.StringVar(&rejectKindsCSV, "reject", "", "comma-separated list of kinds to reject")
	flags.BoolVar(&c.ExitOnError, "exit-on-error", false, "immediately stop execution when the first error is encountered")
	flags.BoolVar(&c.IgnoreMissingSchemas, "ignore-missing-schemas", false, "skip files with missing schemas instead of failing")
	flags.Var(&ignoreFilenamePatterns, "ignore-filename-pattern", "regular expression specifying paths to ignore (can be specified multiple times)")
	flags.BoolVar(&c.Summary, "summary", false, "print a summary at the end (ignored for junit output)")
	flags.IntVar(&c.NumberOfWorkers, "n", 4, "number of goroutines to run concurrently")
	flags.BoolVar(&c.Strict, "strict", false, "disallow additional properties not in schema")
	flags.StringVar(&c.OutputFormat, "output", "text", "output format - json, junit, tap, text")
	flags.BoolVar(&c.Verbose, "verbose", false, "print results for all resources (ignored for tap and junit output)")
	flags.BoolVar(&c.SkipTLS, "insecure-skip-tls-verify", false, "disable verification of the server's SSL certificate. This will make your HTTPS connections insecure")
	flags.StringVar(&c.Cache, "cache", "", "cache schemas downloaded via HTTP to this folder")
	flags.StringVar(&c.CPUProfileFile, "cpu-prof", "", "debug - log CPU profiling to file")
	flags.BoolVar(&c.Help, "h", false, "show help information")
	flags.BoolVar(&c.Version, "v", false, "show version information")
	flags.Usage = func() {
		fmt.Fprintf(os.Stderr, "Usage: %s [OPTION]... [FILE OR FOLDER]...\n", progName)

		flags.SetOutput(os.Stderr)
		flags.PrintDefaults()
	}

	err := flags.Parse(args)

	c.SkipKinds = splitCSV(skipKindsCSV)
	c.RejectKinds = splitCSV(rejectKindsCSV)
	c.IgnoreFilenamePatterns = ignoreFilenamePatterns
	c.SchemaLocations = schemaLocationsParam
	c.Files = flags.Args()

	if c.Help {
		flags.Usage()
	}

	return c, buf.String(), err
}
// FromFlags retrieves kubeconform's runtime configuration from the command-line parameters
FromFlags retrieves kubeconform's runtime configuration from the command-line parameters
// FromFlags retrieves kubeconform ' s runtime configuration from the command - line parameters
func FromFlags(progName string, args []string) (Config, string, error) {
	var schemaLocationsParam, ignoreFilenamePatterns arrayParam
	var skipKindsCSV, rejectKindsCSV string
	flags := flag.NewFlagSet(progName, flag.ExitOnError)
	var buf bytes.Buffer
	flags.SetOutput(&buf)
	c := Config{}
	c.Files = []string{}
	flags.StringVar(&c.KubernetesVersion, "kubernetes-version", "master", "version of Kubernetes to validate against, e.g.: 1.18.0")
	flags.Var(&schemaLocationsParam, "schema-location", "override schemas location search path (can be specified multiple times)")
	flags.StringVar(&skipKindsCSV, "skip", "", "comma-separated list of kinds to ignore")
	flags.StringVar(&rejectKindsCSV, "reject", "", "comma-separated list of kinds to reject")
	flags.BoolVar(&c.ExitOnError, "exit-on-error", false, "immediately stop execution when the first error is encountered")
	flags.BoolVar(&c.IgnoreMissingSchemas, "ignore-missing-schemas", false, "skip files with missing schemas instead of failing")
	flags.Var(&ignoreFilenamePatterns, "ignore-filename-pattern", "regular expression specifying paths to ignore (can be specified multiple times)")
	flags.BoolVar(&c.Summary, "summary", false, "print a summary at the end (ignored for junit output)")
	flags.IntVar(&c.NumberOfWorkers, "n", 4, "number of goroutines to run concurrently")
	flags.BoolVar(&c.Strict, "strict", false, "disallow additional properties not in schema")
	flags.StringVar(&c.OutputFormat, "output", "text", "output format - json, junit, tap, text")
	flags.BoolVar(&c.Verbose, "verbose", false, "print results for all resources (ignored for tap and junit output)")
	flags.BoolVar(&c.SkipTLS, "insecure-skip-tls-verify", false, "disable verification of the server's SSL certificate. This will make your HTTPS connections insecure")
	flags.StringVar(&c.Cache, "cache", "", "cache schemas downloaded via HTTP to this folder")
	flags.StringVar(&c.CPUProfileFile, "cpu-prof", "", "debug - log CPU profiling to file")
	flags.BoolVar(&c.Help, "h", false, "show help information")
	flags.BoolVar(&c.Version, "v", false, "show version information")
	flags.Usage = func() {
		fmt.Fprintf(os.Stderr, "Usage: %s [OPTION]... [FILE OR FOLDER]...\n", progName)
		flags.SetOutput(os.Stderr)
		flags.PrintDefaults()
	}
	err := flags.Parse(args)
	c.SkipKinds = splitCSV(skipKindsCSV)
	c.RejectKinds = splitCSV(rejectKindsCSV)
	c.IgnoreFilenamePatterns = ignoreFilenamePatterns
	c.SchemaLocations = schemaLocationsParam
	c.Files = flags.Args()
	if c.Help {
		flags.Usage()
	}
	return c, buf.String(), err
}
func FromFlags ( progName string , args [ ] string ) ( Config , string , error ) { var schemaLocationsParam , ignoreFilenamePatterns arrayParam var skipKindsCSV , rejectKindsCSV string flags := flag . NewFlagSet ( progName , flag . ExitOnError ) var buf bytes . Buffer flags . SetOutput ( & buf ) c := Config { } c . Files = [ ] string { } flags . StringVar ( & c . KubernetesVersion , " " , " " , " " ) flags . Var ( & schemaLocationsParam , " " , " " ) flags . StringVar ( & skipKindsCSV , " " , " " , " " ) flags . StringVar ( & rejectKindsCSV , " " , " " , " " ) flags . BoolVar ( & c . ExitOnError , " " , false , " " ) flags . BoolVar ( & c . IgnoreMissingSchemas , " " , false , " " ) flags . Var ( & ignoreFilenamePatterns , " " , " " ) flags . BoolVar ( & c . Summary , " " , false , " " ) flags . IntVar ( & c . NumberOfWorkers , " " , 4 , " " ) flags . BoolVar ( & c . Strict , " " , false , " " ) flags . StringVar ( & c . OutputFormat , " " , " " , " " ) flags . BoolVar ( & c . Verbose , " " , false , " " ) flags . BoolVar ( & c . SkipTLS , " " , false , " " ) flags . StringVar ( & c . Cache , " " , " " , " " ) flags . StringVar ( & c . CPUProfileFile , " " , " " , " " ) flags . BoolVar ( & c . Help , " " , false , " " ) flags . BoolVar ( & c . Version , " " , false , " " ) flags . Usage = func ( ) { fmt . Fprintf ( os . Stderr , " \n " , progName ) flags . SetOutput ( os . Stderr ) flags . PrintDefaults ( ) } err := flags . Parse ( args ) c . SkipKinds = splitCSV ( skipKindsCSV ) c . RejectKinds = splitCSV ( rejectKindsCSV ) c . IgnoreFilenamePatterns = ignoreFilenamePatterns c . SchemaLocations = schemaLocationsParam c . Files = flags . Args ( ) if c . Help { flags . Usage ( ) } return c , buf . String ( ) , err }
FromFlags retrieves kubeconform's runtime configuration from the command-line parameters
FromFlags retrieves kubeconform ' s runtime configuration from the command - line parameters