1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/cmd/man.go
Carlos Alexandro Becker a5d3e7bf4b
feat: replace cobra with coral (#2881)
Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
2022-02-04 16:31:19 -03:00

39 lines
759 B
Go

package cmd
import (
"fmt"
"os"
"github.com/muesli/coral"
mcoral "github.com/muesli/mango-coral"
"github.com/muesli/roff"
)
type manCmd struct {
cmd *coral.Command
}
func newManCmd() *manCmd {
root := &manCmd{}
cmd := &coral.Command{
Use: "man",
Short: "Generates GoReleaser's command line manpages",
SilenceUsage: true,
DisableFlagsInUseLine: true,
Hidden: true,
Args: coral.NoArgs,
RunE: func(cmd *coral.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
}