1
1
Fork 0
mirror of https://github.com/goreleaser/nfpm synced 2024-05-28 09:56:20 +02:00
nfpm/internal/cmd/docs.go
Carlos A Becker c33782561a
docs: update help after cobra upgrade
Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
2021-12-15 15:20:55 -03:00

36 lines
778 B
Go

package cmd
import (
"strings"
"github.com/spf13/cobra"
"github.com/spf13/cobra/doc"
)
type docsCmd struct {
cmd *cobra.Command
}
func newDocsCmd() *docsCmd {
root := &docsCmd{}
cmd := &cobra.Command{
Use: "docs",
Short: "Generates nFPM's command line docs",
SilenceUsage: true,
DisableFlagsInUseLine: true,
Hidden: true,
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
root.cmd.Root().DisableAutoGenTag = true
return doc.GenMarkdownTreeCustom(root.cmd.Root(), "www/docs/cmd", func(_ string) string {
return ""
}, func(s string) string {
return "/cmd/" + strings.TrimSuffix(s, ".md") + "/"
})
},
}
root.cmd = cmd
return root
}