X Tutup
Skip to content

Commit 92130d9

Browse files
committed
Minimal manpage generation from cobra
1 parent c7f7bfc commit 92130d9

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@
1616
.DS_Store
1717

1818
vendor/
19+
20+
manpage

.goreleaser.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ archives:
3535
replacements:
3636
darwin: macOS
3737
format: tar.gz
38+
files:
39+
- manpage/gh*.1
3840
- id: windows
3941
builds: [windows]
4042
<<: *archive_defaults
@@ -76,6 +78,8 @@ nfpms:
7678
formats:
7779
- deb
7880
- rpm
81+
files:
82+
"./manpage/gh*.1": "/usr/share/man/man1"
7983

8084
scoop:
8185
bucket:

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,11 @@ endif
4444
git -C site commit -m '$(GITHUB_REF:refs/tags/v%=%)' index.html
4545
git -C site push
4646
.PHONY: site-publish
47+
48+
49+
manpage:
50+
mkdir -p $@
51+
52+
.PHONY: manpages
53+
manpages: manpage
54+
go run ./cmd/gen-docs ./manpage

cmd/gen-docs/main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ func main() {
2424
if err != nil {
2525
fatal(err)
2626
}
27+
28+
err = doc.GenManTree(command.RootCmd, nil, dir)
29+
if err != nil {
30+
fatal(err)
31+
}
2732
}
2833

2934
func filePrepender(filename string) string {

0 commit comments

Comments
 (0)
X Tutup