From 3d09de891072985e6c59f899f09132a76d44f7cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 23 Nov 2015 16:51:12 +0100 Subject: [PATCH] Restructure the gen commands Fixes #1603 --- commands/gen.go | 10 ++++++++++ commands/genautocomplete.go | 2 +- commands/gendoc.go | 2 +- commands/genman.go | 2 +- commands/hugo.go | 9 ++++++--- 5 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 commands/gen.go diff --git a/commands/gen.go b/commands/gen.go new file mode 100644 index 000000000..86bc4918a --- /dev/null +++ b/commands/gen.go @@ -0,0 +1,10 @@ +package commands + +import ( + "github.com/spf13/cobra" +) + +var genCmd = &cobra.Command{ + Use: "gen", + Short: "A collection of several useful generators.", +} diff --git a/commands/genautocomplete.go b/commands/genautocomplete.go index b37762e9c..2a2fcdd91 100644 --- a/commands/genautocomplete.go +++ b/commands/genautocomplete.go @@ -11,7 +11,7 @@ var autocompleteTarget string var autocompleteType string var genautocompleteCmd = &cobra.Command{ - Use: "genautocomplete", + Use: "autocomplete", Short: "Generate shell autocompletion script for Hugo", Long: `Generates a shell autocompletion script for Hugo. diff --git a/commands/gendoc.go b/commands/gendoc.go index fa0a7b9be..ed7f073ac 100644 --- a/commands/gendoc.go +++ b/commands/gendoc.go @@ -22,7 +22,7 @@ url: %s var gendocdir string var gendocCmd = &cobra.Command{ - Use: "gendoc", + Use: "doc", Short: "Generate Markdown documentation for the Hugo CLI.", Long: `Generate Markdown documentation for the Hugo CLI. diff --git a/commands/genman.go b/commands/genman.go index 1c8ec45a0..1992628f0 100644 --- a/commands/genman.go +++ b/commands/genman.go @@ -9,7 +9,7 @@ import ( ) var genmanCmd = &cobra.Command{ - Use: "genman", + Use: "man", Short: "Generate man pages for the Hugo CLI", Long: `This command automatically generates up-to-date man pages of Hugo's command-line interface. By default, it creates the man page files diff --git a/commands/hugo.go b/commands/hugo.go index 28a6d43b8..3420fc526 100644 --- a/commands/hugo.go +++ b/commands/hugo.go @@ -86,10 +86,13 @@ func AddCommands() { HugoCmd.AddCommand(newCmd) HugoCmd.AddCommand(listCmd) HugoCmd.AddCommand(undraftCmd) - HugoCmd.AddCommand(genautocompleteCmd) - HugoCmd.AddCommand(gendocCmd) - HugoCmd.AddCommand(genmanCmd) HugoCmd.AddCommand(importCmd) + + HugoCmd.AddCommand(genCmd) + genCmd.AddCommand(genautocompleteCmd) + genCmd.AddCommand(gendocCmd) + genCmd.AddCommand(genmanCmd) + } //Initializes flags