Skip to content

Commit

Permalink
Remove dead code
Browse files Browse the repository at this point in the history
found flag is a remnant from the time when ls command used to take a group name as argument. However, group ls does not take any arguments now
  • Loading branch information
nishanthvijayan committed Mar 31, 2019
1 parent fa47451 commit 93e099e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions cmd/kaf/group.go
Expand Up @@ -52,7 +52,7 @@ var groupsCmd = &cobra.Command{
var groupLsCmd = &cobra.Command{
Use: "ls",
Short: "List groups",
Args: cobra.MaximumNArgs(1),
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
admin, err := getClusterAdmin()
if err != nil {
Expand All @@ -79,8 +79,6 @@ var groupLsCmd = &cobra.Command{
fmt.Fprintf(w, "NAME\tSTATE\tCONSUMERS\t\n")
}

found := false

groupDescs, err := admin.DescribeConsumerGroups(groupList)
if err != nil {
panic(err)
Expand All @@ -92,10 +90,10 @@ var groupLsCmd = &cobra.Command{
fmt.Fprintf(w, "%v\t%v\t%v\t\n", detail.GroupId, state, consumers)
}

if found || len(args) == 0 {
if len(groupDescs) != 0 {
w.Flush()
} else {
fmt.Printf("Group %v not found\n", args[0])
fmt.Printf("No Groups found\n")
}

return
Expand Down

0 comments on commit 93e099e

Please sign in to comment.