mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 15:58:37 +00:00
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.
This commit is contained in:
parent
b6211c6e79
commit
958a7113de
@ -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...)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user