1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-04 03:11:55 +02:00
goreleaser/cmd/man.go
Carlos A Becker d1291650f2
feat: migrate back to cobra
now that cobra does not require a lot of unused deps because of viper anymore, we can migrate back to it.

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
2022-05-06 20:38:50 -03:00

39 lines
758 B
Go

package cmd
import (
"fmt"
"os"
mcoral "github.com/muesli/mango-cobra"
"github.com/muesli/roff"
"github.com/spf13/cobra"
)
type manCmd struct {
cmd *cobra.Command
}
func newManCmd() *manCmd {
root := &manCmd{}
cmd := &cobra.Command{
Use: "man",
Short: "Generates GoReleaser's command line manpages",
SilenceUsage: true,
DisableFlagsInUseLine: true,
Hidden: true,
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
manPage, err := mcoral.NewManPage(1, root.cmd.Root())
if err != nil {
return err
}
_, err = fmt.Fprint(os.Stdout, manPage.Build(roff.NewDocument()))
return err
},
}
root.cmd = cmd
return root
}