Skip to content

Commit

Permalink
Accept filters multiple times in history list. (#3979)
Browse files Browse the repository at this point in the history
ListEvaluationHistory RPC accepts multiple entries for string-like
filters, e.g. evaluation statuses, profile names, etc. While minder
CLI internally manages those filters as slices, viper is not
configured to accept repeated options.

This change makes it possible to provide `--profile-name`,
`--entity-name`, `--entity-type`, `--eval-status`,
`--remediation-status`, and `--alert-status` options multiple times
with different values, all of which will eventually be passed to the
backend as filters.

Fixes #3978
  • Loading branch information
blkt authored Jul 25, 2024
1 parent 9b42919 commit f5629d9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cmd/cli/app/history/history_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,12 @@ func init() {
entityTypesMsg := fmt.Sprintf(basicMsg, "entity type", strings.Join(entityTypes, ", "))

// Flags
listCmd.Flags().String("profile-name", "", "Filter evaluation history list by profile name")
listCmd.Flags().String("entity-name", "", "Filter evaluation history list by entity name")
listCmd.Flags().String("entity-type", "", entityTypesMsg)
listCmd.Flags().String("eval-status", "", evalFilterMsg)
listCmd.Flags().String("remediation-status", "", remediationFilterMsg)
listCmd.Flags().String("alert-status", "", alertFilterMsg)
listCmd.Flags().StringSlice("profile-name", nil, "Filter evaluation history list by profile name")
listCmd.Flags().StringSlice("entity-name", nil, "Filter evaluation history list by entity name")
listCmd.Flags().StringSlice("entity-type", nil, entityTypesMsg)
listCmd.Flags().StringSlice("eval-status", nil, evalFilterMsg)
listCmd.Flags().StringSlice("remediation-status", nil, remediationFilterMsg)
listCmd.Flags().StringSlice("alert-status", nil, alertFilterMsg)
listCmd.Flags().String("from", "", "Filter evaluation history list by time")
listCmd.Flags().String("to", "", "Filter evaluation history list by time")
listCmd.Flags().StringP("cursor", "c", "", "Fetch previous or next page from the list")
Expand Down

0 comments on commit f5629d9

Please sign in to comment.