mirror of
https://github.com/gohugoio/hugo.git
synced 2025-05-06 10:46:34 +03:00
update to use cobra's sub package doc
This commit is contained in:
parent
a291f3c5d9
commit
1d6286b094
2 changed files with 10 additions and 7 deletions
|
@ -15,14 +15,16 @@ package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/spf13/cobra"
|
|
||||||
"github.com/spf13/hugo/helpers"
|
|
||||||
"github.com/spf13/hugo/hugofs"
|
|
||||||
jww "github.com/spf13/jwalterweatherman"
|
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
"github.com/spf13/cobra/doc"
|
||||||
|
"github.com/spf13/hugo/helpers"
|
||||||
|
"github.com/spf13/hugo/hugofs"
|
||||||
|
jww "github.com/spf13/jwalterweatherman"
|
||||||
)
|
)
|
||||||
|
|
||||||
const gendocFrontmatterTemplate = `---
|
const gendocFrontmatterTemplate = `---
|
||||||
|
@ -67,7 +69,7 @@ for rendering in Hugo.`,
|
||||||
}
|
}
|
||||||
|
|
||||||
jww.FEEDBACK.Println("Generating Hugo command-line documentation in", gendocdir, "...")
|
jww.FEEDBACK.Println("Generating Hugo command-line documentation in", gendocdir, "...")
|
||||||
cobra.GenMarkdownTreeCustom(cmd.Root(), gendocdir, prepender, linkHandler)
|
doc.GenMarkdownTreeCustom(cmd.Root(), gendocdir, prepender, linkHandler)
|
||||||
jww.FEEDBACK.Println("Done.")
|
jww.FEEDBACK.Println("Done.")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -18,6 +18,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"github.com/spf13/cobra/doc"
|
||||||
"github.com/spf13/hugo/helpers"
|
"github.com/spf13/hugo/helpers"
|
||||||
"github.com/spf13/hugo/hugofs"
|
"github.com/spf13/hugo/hugofs"
|
||||||
jww "github.com/spf13/jwalterweatherman"
|
jww "github.com/spf13/jwalterweatherman"
|
||||||
|
@ -32,7 +33,7 @@ command-line interface. By default, it creates the man page files
|
||||||
in the "man" directory under the current directory.`,
|
in the "man" directory under the current directory.`,
|
||||||
|
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
header := &cobra.GenManHeader{
|
header := &doc.GenManHeader{
|
||||||
Section: "1",
|
Section: "1",
|
||||||
Manual: "Hugo Manual",
|
Manual: "Hugo Manual",
|
||||||
Source: fmt.Sprintf("Hugo %s", helpers.HugoVersion()),
|
Source: fmt.Sprintf("Hugo %s", helpers.HugoVersion()),
|
||||||
|
@ -47,7 +48,7 @@ in the "man" directory under the current directory.`,
|
||||||
cmd.Root().DisableAutoGenTag = true
|
cmd.Root().DisableAutoGenTag = true
|
||||||
|
|
||||||
jww.FEEDBACK.Println("Generating Hugo man pages in", genmandir, "...")
|
jww.FEEDBACK.Println("Generating Hugo man pages in", genmandir, "...")
|
||||||
cmd.Root().GenManTree(header, genmandir)
|
doc.GenManTree(cmd.Root(), header, genmandir)
|
||||||
|
|
||||||
jww.FEEDBACK.Println("Done.")
|
jww.FEEDBACK.Println("Done.")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue