Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Commit

Permalink
Fix the issue of admin command lack of some show and list subcommands (
Browse files Browse the repository at this point in the history
  • Loading branch information
kobeyang authored Aug 14, 2017
1 parent 516439e commit 1341daf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/tools/common/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ func SetCommonCommands(

// SetAdminCommands sets the admin commands
func SetAdminCommands(commands *[]cli.Command) {
showCommand := getCommand(commands, "show")
showCommand := getCommand(*commands, "show")
showCommand.Usage = "show (destination | consumergroup | extent | storehost | message | dlq | cgAckID | cgqueue | destqueue | cgBacklog)"
showCommand.Subcommands = append(showCommand.Subcommands, []cli.Command{
{
Expand Down Expand Up @@ -570,7 +570,7 @@ func SetAdminCommands(commands *[]cli.Command) {
},
}...)

listCommand := getCommand(commands, "list")
listCommand := getCommand(*commands, "list")
listCommand.Usage = "list (destination | consumergroup | extents | consumergroupextents | hosts)"
listCommand.Subcommands = append(listCommand.Subcommands, []cli.Command{
{
Expand Down Expand Up @@ -918,10 +918,10 @@ func SetAdminCommands(commands *[]cli.Command) {

}

func getCommand(commands *[]cli.Command, name string) *cli.Command {
for _, command := range *commands {
func getCommand(commands []cli.Command, name string) *cli.Command {
for i, command := range commands {
if command.Name == name {
return &command
return &commands[i]
}
}
return &cli.Command{}
Expand Down

0 comments on commit 1341daf

Please sign in to comment.