Commit 958a7113 authored by Waseem Ahmad's avatar Waseem Ahmad

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.
parent b6211c6e
...@@ -29,9 +29,7 @@ type CommandGroups []CommandGroup ...@@ -29,9 +29,7 @@ type CommandGroups []CommandGroup
func (g CommandGroups) Add(c *cobra.Command) { func (g CommandGroups) Add(c *cobra.Command) {
for _, group := range g { for _, group := range g {
for _, command := range group.Commands { c.AddCommand(group.Commands...)
c.AddCommand(command)
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment