diff --git a/cmd/kubeconform/main.go b/cmd/kubeconform/main.go index 979b45f..a694bbe 100644 --- a/cmd/kubeconform/main.go +++ b/cmd/kubeconform/main.go @@ -217,7 +217,7 @@ func getFiles(files []string, fileBatches chan []string, validationResults chan func realMain() int { var schemaLocationsParam arrayParam var skipKindsCSV, k8sVersion, outputFormat string - var summary, strict, verbose, ignoreMissingSchemas bool + var summary, strict, verbose, ignoreMissingSchemas, help bool var nWorkers int var err error var files []string @@ -231,8 +231,19 @@ func realMain() int { flag.BoolVar(&strict, "strict", false, "disallow additional properties not in schema") flag.StringVar(&outputFormat, "output", "text", "output format - text, json") flag.BoolVar(&verbose, "verbose", false, "print results for all resources") + flag.BoolVar(&help, "h", false, "show help information") + flag.Usage = func() { + fmt.Fprintf(os.Stderr, "Usage: %s [OPTION]... [FILE OR FOLDER]...\n", os.Args[0]) + flag.PrintDefaults() + } + flag.Parse() + if help { + flag.Usage() + return 1 + } + skipKinds := skipKindsMap(skipKindsCSV) for _, file := range flag.Args() { diff --git a/pkg/output/json.go b/pkg/output/json.go index 84ea906..682bbe3 100644 --- a/pkg/output/json.go +++ b/pkg/output/json.go @@ -61,7 +61,7 @@ func (o *jsono) Write(filename, kind, name, version string, err error, skipped b case EMPTY: } - if o.verbose || (s != VALID && s != SKIPPED && s != EMPTY ) { + if o.verbose || (s != VALID && s != SKIPPED && s != EMPTY) { o.results = append(o.results, result{Filename: filename, Kind: kind, Name: name, Version: version, Status: st, Msg: msg}) }