Skip to content

Commit

Permalink
Merge pull request #51 from bpineau/manpage
Browse files Browse the repository at this point in the history
Add a man page
  • Loading branch information
bpineau authored Apr 27, 2018
2 parents a1e49eb + 9d295a5 commit 74881fb
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ kubernetes-backup
dist/*
katafygio
profile.cov
katafygio.8.gz
4 changes: 4 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ builds:
- arm
- arm64
- "386"
hooks:
post: make man

release:
# don't autopublish
Expand Down Expand Up @@ -52,6 +54,8 @@ nfpm:
- git
config_files:
"./assets/katafygio.yaml": "/etc/katafygio/katafygio.yaml"
files:
"./katafygio.8.gz": "/usr/share/man/man8/katafygio.8.gz"
overrides:
rpm:
replacements:
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ lint:
--enable=goimports \
./...

man:
go run assets/manpage.go

fmt:
go fmt ./...

Expand Down
43 changes: 43 additions & 0 deletions assets/manpage.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// +build ignore

package main

import (
"compress/gzip"
"log"
"os"

"github.com/bpineau/katafygio/cmd"
"github.com/spf13/cobra/doc"
)

func main() {
header := &doc.GenManHeader{
Title: "KATAFYGIO",
Section: "8",
Source: "Katafygio",
}

f, err := os.Create("katafygio.8.gz")
if err != nil {
log.Fatal(err)
}

zw := gzip.NewWriter(f)

if err = doc.GenMan(cmd.RootCmd, header, zw); err != nil {
log.Fatal(err)
}

if err = zw.Flush(); err != nil {
log.Fatal(err)
}

if err = zw.Close(); err != nil {
log.Fatal(err)
}

if err = f.Close(); err != nil {
log.Fatal(err)
}
}
16 changes: 13 additions & 3 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ import:
version: ^1.1.0
- package: github.com/Azure/go-autorest
version: v9.10.0
- package: github.com/russross/blackfriday
version: ~2.0.0

0 comments on commit 74881fb

Please sign in to comment.