commands: Make the gen commands non-global

See #4598
This commit is contained in:
Bjørn Erik Pedersen
2018-04-09 22:09:11 +02:00
parent e26a8b242a
commit e0621d207c
5 changed files with 155 additions and 96 deletions

View File

@@ -17,7 +17,29 @@ import (
"github.com/spf13/cobra"
)
var genCmd = &cobra.Command{
Use: "gen",
Short: "A collection of several useful generators.",
var _ cmder = (*genCmd)(nil)
type genCmd struct {
cmd *cobra.Command
}
func (c *genCmd) getCommand() *cobra.Command {
return c.cmd
}
func newGenCmd() *genCmd {
cc := &genCmd{}
cc.cmd = &cobra.Command{
Use: "gen",
Short: "A collection of several useful generators.",
}
cc.cmd.AddCommand(
newGenautocompleteCmd().getCommand(),
newGenDocCmd().getCommand(),
newGenManCmd().getCommand(),
createGenDocsHelper().getCommand(),
createGenChromaStyles().getCommand())
return cc
}