From 958a7113de48344e38f16eb47542d30d7233ae8b Mon Sep 17 00:00:00 2001 From: Waseem Ahmad Date: Fri, 19 May 2017 08:38:35 +0530 Subject: [PATCH] Use variadic nature of *cobra.Command.AddCommand to add group of commands to a parent command Rather than looping over commands in a group and add it one by one to a parent command, use variadic nature of *cobra.Command.AddCommand to add the group of commands to the parent. --- pkg/kubectl/cmd/templates/command_groups.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/kubectl/cmd/templates/command_groups.go b/pkg/kubectl/cmd/templates/command_groups.go index 42baa85a60..447a39621f 100644 --- a/pkg/kubectl/cmd/templates/command_groups.go +++ b/pkg/kubectl/cmd/templates/command_groups.go @@ -29,9 +29,7 @@ type CommandGroups []CommandGroup func (g CommandGroups) Add(c *cobra.Command) { for _, group := range g { - for _, command := range group.Commands { - c.AddCommand(command) - } + c.AddCommand(group.Commands...) } }