diff --git a/cmd/loop/docs.go b/cmd/loop/docs.go index 30488a07..7296675c 100644 --- a/cmd/loop/docs.go +++ b/cmd/loop/docs.go @@ -2,25 +2,12 @@ package main import ( "context" - _ "embed" "fmt" docs "github.com/urfave/cli-docs/v3" "github.com/urfave/cli/v3" ) -//go:embed markdown_tabular.md.gotmpl -var markdownTabularDocTemplate string - -// We have a copy of this template taken from -// https://github.com/urfave/cli-docs where we remove column -// "Environment variables" if it has no values. -// TODO: remove this when https://github.com/urfave/cli-docs/pull/15 -// is merged. -func init() { - docs.MarkdownTabularDocTemplate = markdownTabularDocTemplate -} - var printManCommand = &cli.Command{ Name: "man", Usage: "prints man file", diff --git a/cmd/loop/markdown_tabular.md.gotmpl b/cmd/loop/markdown_tabular.md.gotmpl deleted file mode 100644 index 4697d33c..00000000 --- a/cmd/loop/markdown_tabular.md.gotmpl +++ /dev/null @@ -1,80 +0,0 @@ -{{ define "flags" }} -{{- $hasEnvVars := false -}} -{{- range . -}} -{{- if and (not $hasEnvVars) .EnvVars -}} -{{- $hasEnvVars = true -}} -{{- end -}} -{{- end }} -| Name | Description | Type | Default value {{ if $hasEnvVars }}| Environment variables {{ end }}| -|------|-------------|------|:-------------:{{ if $hasEnvVars }}|:---------------------:{{ end }}| -{{ range $flag := . -}} -{{- /**/ -}} | `{{ $flag.Name }}{{ if $flag.TakesValue }}="…"{{ end }}` {{ if $flag.Aliases }}(`{{ join $flag.Aliases "`, `" }}`) {{ end }} -{{- /**/ -}} | {{ $flag.Usage }} -{{- /**/ -}} | {{ $flag.Type }} -{{- /**/ -}} | {{ if $flag.Default }}`{{ $flag.Default }}`{{ end }} -{{- if $hasEnvVars -}} -{{- /**/ -}} | {{ if $flag.EnvVars }}`{{ join $flag.EnvVars "`, `" }}`{{ else }}*none*{{ end }} -{{- end -}} -{{- /**/ -}} | -{{ end }} -{{ end }} - -{{ define "command" }} -### `{{ .Name }}` {{ if gt .Level 0 }}sub{{ end }}command{{ if .Aliases }} (aliases: `{{ join .Aliases "`, `" }}`){{ end }} -{{ if .Usage }} -{{ .Usage }}. -{{ end }} -{{ if .UsageText }} -{{ range $line := .UsageText -}} -> {{ $line }} -{{ end -}} -{{ end }} -{{ if .Description }} -{{ .Description }}. -{{ end }} -Usage: - -```bash -$ {{ .AppPath }} [GLOBAL FLAGS] {{ .Name }}{{ if .Flags }} [COMMAND FLAGS]{{ end }} {{ if .ArgsUsage }}{{ .ArgsUsage }}{{ else }}[ARGUMENTS...]{{ end }} -``` - -{{ if .Flags -}} -The following flags are supported: -{{ template "flags" .Flags }} -{{ end -}} - -{{ if .SubCommands -}} -{{ range $subCmd := .SubCommands -}} -{{ template "command" $subCmd }} -{{ end -}} -{{ end -}} -{{ end }} - -## CLI interface{{ if .Name }} - {{ .Name }}{{ end }} - -{{ if .Description }}{{ .Description }}. -{{ end }} -{{ if .Usage }}{{ .Usage }}. -{{ end }} -{{ if .UsageText }} -{{ range $line := .UsageText -}} -> {{ $line }} -{{ end -}} -{{ end }} -Usage: - -```bash -$ {{ .AppPath }}{{ if .GlobalFlags }} [GLOBAL FLAGS]{{ end }} [COMMAND] [COMMAND FLAGS] {{ if .ArgsUsage }}{{ .ArgsUsage }}{{ else }}[ARGUMENTS...]{{ end }} -``` - -{{ if .GlobalFlags }} -Global flags: - -{{ template "flags" .GlobalFlags }} - -{{ end -}} -{{ if .Commands -}} -{{ range $cmd := .Commands -}} -{{ template "command" $cmd }} -{{ end }} -{{- end }} diff --git a/go.mod b/go.mod index 7c0aa4d7..ac8d5b1c 100644 --- a/go.mod +++ b/go.mod @@ -34,7 +34,7 @@ require ( github.com/lightningnetwork/lnd/tor v1.1.6 github.com/ory/dockertest/v3 v3.10.0 github.com/stretchr/testify v1.10.0 - github.com/urfave/cli-docs/v3 v3.1.0 + github.com/urfave/cli-docs/v3 v3.1.1-0.20251020101624-bec07369b4f6 github.com/urfave/cli/v3 v3.4.1 go.etcd.io/bbolt v1.4.3 golang.org/x/sync v0.13.0 diff --git a/go.sum b/go.sum index 33d7d169..31e42487 100644 --- a/go.sum +++ b/go.sum @@ -1313,8 +1313,8 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 h1:uruHq4 github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tv42/zbase32 v0.0.0-20160707012821-501572607d02 h1:tcJ6OjwOMvExLlzrAVZute09ocAGa7KqOON60++Gz4E= github.com/tv42/zbase32 v0.0.0-20160707012821-501572607d02/go.mod h1:tHlrkM198S068ZqfrO6S8HsoJq2bF3ETfTL+kt4tInY= -github.com/urfave/cli-docs/v3 v3.1.0 h1:Sa5xm19IpE5gpm6tZzXdfjdFxn67PnEsE4dpXF7vsKw= -github.com/urfave/cli-docs/v3 v3.1.0/go.mod h1:59d+5Hz1h6GSGJ10cvcEkbIe3j233t4XDqI72UIx7to= +github.com/urfave/cli-docs/v3 v3.1.1-0.20251020101624-bec07369b4f6 h1:cm0BrTu3Q0CNo+vB5kErCcVMZqD2D1z7y3YVIiBlr+o= +github.com/urfave/cli-docs/v3 v3.1.1-0.20251020101624-bec07369b4f6/go.mod h1:59d+5Hz1h6GSGJ10cvcEkbIe3j233t4XDqI72UIx7to= github.com/urfave/cli/v3 v3.4.1 h1:1M9UOCy5bLmGnuu1yn3t3CB4rG79Rtoxuv1sPhnm6qM= github.com/urfave/cli/v3 v3.4.1/go.mod h1:FJSKtM/9AiiTOJL4fJ6TbMUkxBXn7GO9guZqoZtpYpo= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=