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/public
docs/content/signaldctl docs/content/signaldctl
# man page files generated for the debian package
*.1
debian/manpages
# Binaries for programs and plugins # Binaries for programs and plugins
*.exe *.exe
*.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 git-buildpackage dh-golang golang-any golang-github-spf13-cobra-dev golang-github-spf13-viper-dev
- apt-get install -y ./*.deb && rm -vf *.deb - apt-get install -y ./*.deb && rm -vf *.deb
script: 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)" - 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 - dpkg-buildpackage -us -uc -b
- mv ../*.deb . - mv ../*.deb .
@ -68,6 +71,7 @@ build:x86:deb:
artifacts: artifacts:
paths: paths:
- "*.deb" - "*.deb"
- "*.1"
expire_in: 1 month expire_in: 1 month
publish deb: publish deb:
@ -96,7 +100,7 @@ pages:
- apt-get update && apt-get install -y hugo - apt-get update && apt-get install -y hugo
script: script:
- mkdir -p docs/content/signaldctl - 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 - cd docs
- hugo - hugo
- mv public ../ - mv public ../

View file

@ -32,8 +32,20 @@ var DocCmd = &cobra.Command{
Aliases: []string{"docs"}, Aliases: []string{"docs"},
Hidden: true, Hidden: true,
Annotations: map[string]string{common.AnnotationNoSocketConnection: "true"}, Annotations: map[string]string{common.AnnotationNoSocketConnection: "true"},
Run: func(_ *cobra.Command, _ []string) { Run: func(_ *cobra.Command, args []string) {
err := doc.GenMarkdownTreeCustom(RootCmd, "./docs/content/signaldctl", filePrepender, linkHandler) 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 { if err != nil {
log.Fatal(err) log.Fatal(err)
} }

View file

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

1
docs/README.md Normal file
View file

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