don't connect to signald socket when generating docs
This commit is contained in:
parent
1b1ade7170
commit
d1890fbd42
4 changed files with 21 additions and 13 deletions
|
@ -25,12 +25,14 @@ import (
|
|||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/cobra/doc"
|
||||
"gitlab.com/signald/signald-go/cmd/signaldctl/common"
|
||||
)
|
||||
|
||||
var DocCmd = &cobra.Command{
|
||||
Use: "doc",
|
||||
Aliases: []string{"docs"},
|
||||
Hidden: true,
|
||||
Use: "doc",
|
||||
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)
|
||||
if err != nil {
|
||||
|
|
|
@ -43,6 +43,11 @@ var RootCmd = &cobra.Command{
|
|||
if socketPath == "" {
|
||||
socketPath = config.Config.SocketPath
|
||||
}
|
||||
|
||||
if _, ok := cmd.Annotations[common.AnnotationNoSocketConnection]; ok {
|
||||
return
|
||||
}
|
||||
|
||||
common.Signald = &signald.Signald{SocketPath: config.Config.SocketPath}
|
||||
if err := common.Signald.Connect(); err != nil {
|
||||
log.Fatal(err)
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
package common
|
||||
|
||||
const (
|
||||
OutputFormatDefault = "default"
|
||||
OutputFormatCSV = "csv"
|
||||
OutputFormatTable = "table"
|
||||
OutputFormatJSON = "json"
|
||||
OutputFormatYAML = "yaml"
|
||||
OutputFormatQR = "qr"
|
||||
)
|
|
@ -6,6 +6,17 @@ import (
|
|||
"gitlab.com/signald/signald-go/signald"
|
||||
)
|
||||
|
||||
const (
|
||||
OutputFormatDefault = "default"
|
||||
OutputFormatCSV = "csv"
|
||||
OutputFormatTable = "table"
|
||||
OutputFormatJSON = "json"
|
||||
OutputFormatYAML = "yaml"
|
||||
OutputFormatQR = "qr"
|
||||
|
||||
AnnotationNoSocketConnection = "no-socket"
|
||||
)
|
||||
|
||||
var (
|
||||
Signald *signald.Signald
|
||||
|
||||
|
|
Loading…
Reference in a new issue