aboutsummaryrefslogtreecommitdiffhomepage
path: root/commands/gen.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2018-04-09 22:09:11 +0200
committerBjørn Erik Pedersen <[email protected]>2018-04-11 09:50:18 +0200
commite0621d207ce3278a82f8a60607e9cdd304149029 (patch)
tree086cebf89d337a5e65834b32fc06c0f04ea3b413 /commands/gen.go
parente26a8b242a6434117d089a0799238add7025dbf4 (diff)
downloadhugo-e0621d207ce3278a82f8a60607e9cdd304149029.tar.gz
hugo-e0621d207ce3278a82f8a60607e9cdd304149029.zip
commands: Make the gen commands non-global
See #4598
Diffstat (limited to 'commands/gen.go')
-rw-r--r--commands/gen.go28
1 files changed, 25 insertions, 3 deletions
diff --git a/commands/gen.go b/commands/gen.go
index 62a84b0d0..c22d8f8b0 100644
--- a/commands/gen.go
+++ b/commands/gen.go
@@ -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
}