@@ -13,6 +13,7 @@ import (
1313 "github.com/redhat-developer/app-services-cli/pkg/cmd/flag"
1414 "github.com/redhat-developer/app-services-cli/pkg/cmdutil"
1515 flagutil "github.com/redhat-developer/app-services-cli/pkg/cmdutil/flags"
16+
1617 "github.com/redhat-developer/app-services-cli/pkg/connection"
1718 "github.com/redhat-developer/app-services-cli/pkg/dump"
1819 "github.com/redhat-developer/app-services-cli/pkg/iostreams"
@@ -34,6 +35,7 @@ type Options struct {
3435 kafkaID string
3536 limit int32
3637 topic string
38+ search string
3739}
3840
3941type consumerGroupRow struct {
@@ -81,6 +83,7 @@ func NewListConsumerGroupCommand(f *factory.Factory) *cobra.Command {
8183 cmd .Flags ().Int32VarP (& opts .limit , "limit" , "" , 1000 , opts .localizer .MustLocalize ("kafka.consumerGroup.list.flag.limit" ))
8284 cmd .Flags ().StringVarP (& opts .output , "output" , "o" , "" , opts .localizer .MustLocalize ("kafka.consumerGroup.list.flag.output.description" ))
8385 cmd .Flags ().StringVar (& opts .topic , "topic" , "" , opts .localizer .MustLocalize ("kafka.consumerGroup.list.flag.topic.description" ))
86+ cmd .Flags ().StringVar (& opts .search , "search" , "" , opts .localizer .MustLocalize ("kafka.consumerGroup.list.flag.search" ))
8487
8588 _ = cmd .RegisterFlagCompletionFunc ("topic" , func (cmd * cobra.Command , _ []string , toComplete string ) ([]string , cobra.ShellCompDirective ) {
8689 return cmdutil .FilterValidTopicNameArgs (f , toComplete )
@@ -91,6 +94,7 @@ func NewListConsumerGroupCommand(f *factory.Factory) *cobra.Command {
9194 return cmd
9295}
9396
97+ // nolint:funlen
9498func runList (opts * Options ) (err error ) {
9599 conn , err := opts .Connection (connection .DefaultConfigRequireMasAuth )
96100 if err != nil {
@@ -114,6 +118,10 @@ func runList(opts *Options) (err error) {
114118 if opts .topic != "" {
115119 req = req .Topic (opts .topic )
116120 }
121+ if opts .search != "" {
122+ req = req .GroupIdFilter (opts .search )
123+ }
124+
117125 consumerGroupData , httpRes , err := req .Execute ()
118126 if err != nil {
119127 if httpRes == nil {
0 commit comments