From 1341dafdc51cd3d0a9ca85c7f116bb0b5beeb6ed Mon Sep 17 00:00:00 2001 From: Guang Yang Date: Mon, 14 Aug 2017 13:36:01 -0700 Subject: [PATCH] Fix the issue of admin command lack of some show and list subcommands (#273) --- cmd/tools/common/lib.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/tools/common/lib.go b/cmd/tools/common/lib.go index 6e4c8f21..5a8c41db 100644 --- a/cmd/tools/common/lib.go +++ b/cmd/tools/common/lib.go @@ -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{ { @@ -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{ { @@ -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{}