Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perfspect report flag 'all' is true by default #128

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading