Generate man pages before building the debian package

This commit is contained in:
Finn 2021-02-02 17:13:31 -08:00
parent 82527e7703
commit fd3f363a17
5 changed files with 32 additions and 9 deletions

4
.gitignore vendored
View file

@ -2,6 +2,10 @@
docs/public
docs/content/signaldctl
# man page files generated for the debian package
*.1
debian/manpages
# Binaries for programs and plugins
*.exe
*.exe~

View file

@ -53,6 +53,9 @@ build:x86:deb:
- apt-get install -y git-buildpackage dh-golang golang-any golang-github-spf13-cobra-dev golang-github-spf13-viper-dev
- apt-get install -y ./*.deb && rm -vf *.deb
script:
- echo "generating man pages"
- go run ./cmd/signaldctl doc -o man
- ls *.1 > debian/manpages
- gbp dch --ignore-branch --debian-tag="%(version)s" --git-author --new-version="$(git describe --abbrev=0)+git$(date +%Y-%m-%d)r$(git rev-parse --short=8 HEAD).$(git rev-list $(git describe --abbrev=0)..HEAD --count)"
- dpkg-buildpackage -us -uc -b
- mv ../*.deb .
@ -68,6 +71,7 @@ build:x86:deb:
artifacts:
paths:
- "*.deb"
- "*.1"
expire_in: 1 month
publish deb:
@ -96,7 +100,7 @@ pages:
- apt-get update && apt-get install -y hugo
script:
- mkdir -p docs/content/signaldctl
- SIGNALDCTL_PUBLIC_DOC_MODE=on ./signaldctl doc
- SIGNALDCTL_PUBLIC_DOC_MODE=on ./signaldctl doc -o md ./docs/content/signaldctl
- cd docs
- hugo
- mv public ../

View file

@ -32,8 +32,20 @@ var DocCmd = &cobra.Command{
Aliases: []string{"docs"},
Hidden: true,
Annotations: map[string]string{common.AnnotationNoSocketConnection: "true"},
Run: func(_ *cobra.Command, _ []string) {
err := doc.GenMarkdownTreeCustom(RootCmd, "./docs/content/signaldctl", filePrepender, linkHandler)
Run: func(_ *cobra.Command, args []string) {
var err error
outpath := "./"
if len(args) > 0 {
outpath = args[0]
}
switch common.OutputFormat {
case common.OutputFormatMan:
err = doc.GenManTree(RootCmd, &doc.GenManHeader{Title: "signaldctl"}, outpath)
case common.OutputFormatMarkdown:
err = doc.GenMarkdownTreeCustom(RootCmd, outpath, filePrepender, linkHandler)
case common.OutputFormatYAML:
err = doc.GenYamlTree(RootCmd, outpath)
}
if err != nil {
log.Fatal(err)
}

View file

@ -7,12 +7,14 @@ import (
)
const (
OutputFormatDefault = "default"
OutputFormatCSV = "csv"
OutputFormatTable = "table"
OutputFormatJSON = "json"
OutputFormatYAML = "yaml"
OutputFormatQR = "qr"
OutputFormatDefault = "default"
OutputFormatCSV = "csv"
OutputFormatTable = "table"
OutputFormatJSON = "json"
OutputFormatYAML = "yaml"
OutputFormatQR = "qr"
OutputFormatMarkdown = "md"
OutputFormatMan = "man"
AnnotationNoSocketConnection = "no-socket"
)

1
docs/README.md Normal file
View file

@ -0,0 +1 @@
# [docs are here](https://signald.gitlab.io/signald-go/signaldctl/)