1
1
mirror of https://github.com/goreleaser/nfpm synced 2025-04-20 12:38:04 +02:00
nfpm/internal/cmd/docs.go
Carlos Alexandro Becker 7b3fb8b759
fix: lint issues
2024-03-19 10:14:49 -03:00

37 lines
819 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,
ValidArgsFunction: cobra.NoFileCompletions,
RunE: func(*cobra.Command, []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
}