Merge pull request #46069 from waseem/variadic-command-addition-to-parent-command

Automatic merge from submit-queue

Use variadic nature of *cobra.Command.AddCommand to add group of commands to a parent command

**What this PR does / why we need it**:

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.
pull/6/head
Kubernetes Submit Queue 2017-08-09 06:33:10 -07:00 committed by GitHub
commit 6a0d3c7494
1 changed files with 1 additions and 3 deletions

View File

@ -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...)
}
}