mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-05-29 23:17:55 +02:00
feat: manpages (#2837)
* feat: manpages Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * fix: section Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * feat: use mango instead Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * fix: improvements Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * fix: unused Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
This commit is contained in:
parent
87151f8575
commit
ae583453a7
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,3 +12,4 @@ completions/
|
||||
.vscode/
|
||||
.task/
|
||||
.idea/
|
||||
manpages
|
||||
|
@ -5,6 +5,7 @@ before:
|
||||
hooks:
|
||||
- go mod tidy
|
||||
- ./scripts/completions.sh
|
||||
- ./scripts/manpages.sh
|
||||
|
||||
snapshot:
|
||||
name_template: '{{ incpatch .Version }}-next'
|
||||
@ -149,6 +150,7 @@ brews:
|
||||
bash_completion.install "completions/goreleaser.bash" => "goreleaser"
|
||||
zsh_completion.install "completions/goreleaser.zsh" => "_goreleaser"
|
||||
fish_completion.install "completions/goreleaser.fish"
|
||||
man1.install "manpages/goreleaser.1.gz"
|
||||
|
||||
rigs:
|
||||
- rig:
|
||||
@ -181,6 +183,8 @@ nfpms:
|
||||
dst: /usr/share/fish/completions/goreleaser.fish
|
||||
- src: ./completions/goreleaser.zsh
|
||||
dst: /usr/local/share/zsh/site-functions/_goreleaser
|
||||
- src: ./manpages/goreleaser.1.gz
|
||||
dst: /usr/share/man/man1/goreleaser.1.gz
|
||||
formats:
|
||||
- apk
|
||||
- deb
|
||||
|
38
cmd/man.go
Normal file
38
cmd/man.go
Normal file
@ -0,0 +1,38 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/muesli/mango/mcobra"
|
||||
"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 := mcobra.NewManPageFromCobra(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
|
||||
}
|
@ -83,6 +83,7 @@ single .goreleaser.yaml file.
|
||||
newCheckCmd().cmd,
|
||||
newInitCmd().cmd,
|
||||
newDocsCmd().cmd,
|
||||
newManCmd().cmd,
|
||||
newSchemaCmd().cmd,
|
||||
)
|
||||
|
||||
|
2
go.mod
2
go.mod
@ -24,6 +24,8 @@ require (
|
||||
github.com/imdario/mergo v0.3.12
|
||||
github.com/jarcoal/httpmock v1.1.0
|
||||
github.com/mitchellh/go-homedir v1.1.0
|
||||
github.com/muesli/mango v0.0.0-20220118122812-f367188b892e
|
||||
github.com/muesli/roff v0.1.0
|
||||
github.com/slack-go/slack v0.10.1
|
||||
github.com/spf13/cobra v1.3.0
|
||||
github.com/stretchr/testify v1.7.0
|
||||
|
4
go.sum
4
go.sum
@ -664,6 +664,10 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/muesli/mango v0.0.0-20220118122812-f367188b892e h1:ykZ/Hqqvqm2lmZ1YoruxTWaOb90IKlkMuT0Io9baO+A=
|
||||
github.com/muesli/mango v0.0.0-20220118122812-f367188b892e/go.mod h1:r40g5Hx6ZzbjDW0GZhCpSX2Wyt9SPSDRoQGaODqxSz4=
|
||||
github.com/muesli/roff v0.1.0 h1:YD0lalCotmYuF5HhZliKWlIx7IEhiXeSfq7hNjFqGF8=
|
||||
github.com/muesli/roff v0.1.0/go.mod h1:pjAHQM9hdUUwm/krAfrLGgJkXJ+YuhtsfZ42kieB2Ig=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
||||
|
5
scripts/manpages.sh
Executable file
5
scripts/manpages.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
rm -rf manpages
|
||||
mkdir manpages
|
||||
go run . man | gzip -c >manpages/goreleaser.1.gz
|
Loading…
x
Reference in New Issue
Block a user