Implement CEL filter in list user command

This commit is contained in:
PiMaDaum 2023-02-05 21:57:01 +01:00
parent 6562aeab95
commit f30590588e
2 changed files with 78 additions and 0 deletions

View file

@ -62,6 +62,10 @@ func UserList(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
celFilter, err := cmd.Flags().GetString("filter")
if err != nil {
return err
}
ctx := util.GetContext()
@ -82,6 +86,11 @@ func UserList(cmd *cobra.Command, args []string) error {
return fmt.Errorf("Listing User: %w", err)
}
users, err = filterUsers(&users, celFilter, ctx)
if err != nil {
return err
}
if jsonOutput {
outputUsers := []UserJsonOutput{}
for i := range users {