Skip to content

Commit

Permalink
Minimal manpage generation from cobra
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfurlan committed May 12, 2020
1 parent c7f7bfc commit 92130d9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@
.DS_Store

vendor/

manpage
4 changes: 4 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ archives:
replacements:
darwin: macOS
format: tar.gz
files:
- manpage/gh*.1
- id: windows
builds: [windows]
<<: *archive_defaults
Expand Down Expand Up @@ -76,6 +78,8 @@ nfpms:
formats:
- deb
- rpm
files:
"./manpage/gh*.1": "/usr/share/man/man1"

scoop:
bucket:
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,11 @@ endif
git -C site commit -m '$(GITHUB_REF:refs/tags/v%=%)' index.html
git -C site push
.PHONY: site-publish


manpage:
mkdir -p $@

.PHONY: manpages
manpages: manpage
go run ./cmd/gen-docs ./manpage
5 changes: 5 additions & 0 deletions cmd/gen-docs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ func main() {
if err != nil {
fatal(err)
}

err = doc.GenManTree(command.RootCmd, nil, dir)
if err != nil {
fatal(err)
}
}

func filePrepender(filename string) string {
Expand Down

0 comments on commit 92130d9

Please sign in to comment.