github.com/goreleaser/goreleaser@v1.25.1/cmd/docs.go (about) 1 package cmd 2 3 import ( 4 "strings" 5 6 "github.com/spf13/cobra" 7 "github.com/spf13/cobra/doc" 8 ) 9 10 type docsCmd struct { 11 cmd *cobra.Command 12 } 13 14 func newDocsCmd() *docsCmd { 15 root := &docsCmd{} 16 cmd := &cobra.Command{ 17 Use: "docs", 18 Short: "Generates GoReleaser's command line docs", 19 SilenceUsage: true, 20 DisableFlagsInUseLine: true, 21 Hidden: true, 22 Args: cobra.NoArgs, 23 ValidArgsFunction: cobra.NoFileCompletions, 24 RunE: func(_ *cobra.Command, _ []string) error { 25 root.cmd.Root().DisableAutoGenTag = true 26 return doc.GenMarkdownTreeCustom(root.cmd.Root(), "www/docs/cmd", func(_ string) string { 27 return "" 28 }, func(s string) string { 29 return "/cmd/" + strings.TrimSuffix(s, ".md") + "/" 30 }) 31 }, 32 } 33 34 root.cmd = cmd 35 return root 36 }