cli/pkg/cmdutil/cmdgroup.go
Kynan Ware 9331ee8215 Add godoc comments to exported symbols in pkg/cmdutil
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-04 16:01:52 -07:00

16 lines
399 B
Go

package cmdutil
import "github.com/spf13/cobra"
// AddGroup creates a new command group with the given title and adds the provided commands to it under the parent command.
func AddGroup(parent *cobra.Command, title string, cmds ...*cobra.Command) {
g := &cobra.Group{
Title: title,
ID: title,
}
parent.AddGroup(g)
for _, c := range cmds {
c.GroupID = g.ID
parent.AddCommand(c)
}
}