From 6b16cb2409c295e04d1abadfb77930ae92c5f4f9 Mon Sep 17 00:00:00 2001 From: "Harper, Jason M" Date: Wed, 18 Dec 2024 12:08:36 -0800 Subject: [PATCH] perfspect report flag 'all' is true by default --- cmd/report/report.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/cmd/report/report.go b/cmd/report/report.go index 48c189c..bffb262 100644 --- a/cmd/report/report.go +++ b/cmd/report/report.go @@ -182,7 +182,7 @@ func init() { } // set up other flags Cmd.Flags().StringVar(&common.FlagInput, common.FlagInputName, "", "") - Cmd.Flags().BoolVar(&flagAll, flagAllName, false, "") + Cmd.Flags().BoolVar(&flagAll, flagAllName, true, "") Cmd.Flags().StringSliceVar(&common.FlagFormat, common.FlagFormatName, []string{report.FormatAll}, "") Cmd.Flags().StringSliceVar(&flagBenchmark, flagBenchmarkName, []string{}, "") @@ -263,18 +263,14 @@ func getFlagGroups() []common.FlagGroup { } func validateFlags(cmd *cobra.Command, args []string) error { - // set flagAll if all categories are selected or if none are selected - if !flagAll { - numCategoriesTrue := 0 + // clear flagAll if any categories are selected + if flagAll { for _, cat := range categories { - if *cat.FlagVar { - numCategoriesTrue++ + if cat.FlagVar != nil && *cat.FlagVar { + flagAll = false break } } - if numCategoriesTrue == len(categories) || numCategoriesTrue == 0 { - flagAll = true - } } // validate format options for _, format := range common.FlagFormat {