Skip to content

Commit

Permalink
Merge pull request #128 from intel/reportalltrue
Browse files Browse the repository at this point in the history
perfspect report flag 'all' is true by default
  • Loading branch information
harp-intel authored Dec 19, 2024
2 parents 73961ae + 6b16cb2 commit 4fcd5f7
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 4fcd5f7

Please sign in to comment.