summaryrefslogtreecommitdiffstats
path: root/commands/genman.go
diff options
context:
space:
mode:
authorAnthony Fok <foka@debian.org>2015-11-22 09:19:54 -0700
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2015-11-22 18:54:44 +0100
commit098a0c819af2575628690517f4bd40253d7436d7 (patch)
treed282532a2c1f993beac0f2c96a72927cfd353b1e /commands/genman.go
parent8727475596bc873e1cab203f5c006927671936e0 (diff)
Add commands/genman.go to autogenerate man pages
Fixes #1369
Diffstat (limited to 'commands/genman.go')
-rw-r--r--commands/genman.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/commands/genman.go b/commands/genman.go
new file mode 100644
index 000000000..1c8ec45a0
--- /dev/null
+++ b/commands/genman.go
@@ -0,0 +1,30 @@
+package commands
+
+import (
+ "fmt"
+
+ "github.com/spf13/cobra"
+ "github.com/spf13/hugo/helpers"
+ jww "github.com/spf13/jwalterweatherman"
+)
+
+var genmanCmd = &cobra.Command{
+ Use: "genman",
+ 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
+in the "man" directory under the current directory.`,
+
+ Run: func(cmd *cobra.Command, args []string) {
+ genmandir := "man/"
+ cmd.Root().DisableAutoGenTag = true
+ header := &cobra.GenManHeader{
+ Section: "1",
+ Manual: "Hugo Manual",
+ Source: fmt.Sprintf("Hugo %s", helpers.HugoVersion()),
+ }
+ jww.FEEDBACK.Println("Generating Hugo man pages in", genmandir, "...")
+ cmd.Root().GenManTree(header, genmandir)
+ jww.FEEDBACK.Println("Done.")
+ },
+}