2022-01-18 15:17:52 +02:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
|
2022-02-04 21:31:19 +02:00
|
|
|
"github.com/muesli/coral"
|
|
|
|
mcoral "github.com/muesli/mango-coral"
|
2022-01-18 15:17:52 +02:00
|
|
|
"github.com/muesli/roff"
|
|
|
|
)
|
|
|
|
|
|
|
|
type manCmd struct {
|
2022-02-04 21:31:19 +02:00
|
|
|
cmd *coral.Command
|
2022-01-18 15:17:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func newManCmd() *manCmd {
|
|
|
|
root := &manCmd{}
|
2022-02-04 21:31:19 +02:00
|
|
|
cmd := &coral.Command{
|
2022-01-18 15:17:52 +02:00
|
|
|
Use: "man",
|
|
|
|
Short: "Generates GoReleaser's command line manpages",
|
|
|
|
SilenceUsage: true,
|
|
|
|
DisableFlagsInUseLine: true,
|
|
|
|
Hidden: true,
|
2022-02-04 21:31:19 +02:00
|
|
|
Args: coral.NoArgs,
|
|
|
|
RunE: func(cmd *coral.Command, args []string) error {
|
|
|
|
manPage, err := mcoral.NewManPage(1, root.cmd.Root())
|
2022-01-18 15:17:52 +02:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
_, err = fmt.Fprint(os.Stdout, manPage.Build(roff.NewDocument()))
|
|
|
|
return err
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
root.cmd = cmd
|
|
|
|
return root
|
|
|
|
}
|