Skip to content

Commit

Permalink
perfspect report flag 'all' is true by default
Browse files Browse the repository at this point in the history
  • Loading branch information
harp-intel committed Dec 18, 2024
1 parent 556fbaa commit 6b16cb2
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions cmd/report/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}, "")

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 6b16cb2

Please sign in to comment.