Merge pull request #6085 from thaJeztah/bump_cli_docs_tool

vendor: github.com/docker/cli-docs-tool v0.10.0
This commit is contained in:
Sebastiaan van Stijn 2025-05-20 09:30:29 +02:00 committed by GitHub
commit 067587bf15
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 51 additions and 32 deletions

View File

@ -13,7 +13,7 @@ require (
github.com/cpuguy83/go-md2man/v2 v2.0.7
github.com/creack/pty v1.1.24
github.com/distribution/reference v0.6.0
github.com/docker/cli-docs-tool v0.9.0
github.com/docker/cli-docs-tool v0.10.0
github.com/docker/distribution v2.8.3+incompatible
github.com/docker/docker v28.1.2-0.20250519114040-7937f0846c13+incompatible // master, v28.x dev
github.com/docker/docker-credential-helpers v0.9.3

View File

@ -50,8 +50,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/denisenkom/go-mssqldb v0.0.0-20191128021309-1d7a30a10f73/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
github.com/docker/cli-docs-tool v0.9.0 h1:CVwQbE+ZziwlPqrJ7LRyUF6GvCA+6gj7MTCsayaK9t0=
github.com/docker/cli-docs-tool v0.9.0/go.mod h1:ClrwlNW+UioiRyH9GiAOe1o3J/TsY3Tr1ipoypjAUtc=
github.com/docker/cli-docs-tool v0.10.0 h1:bOD6mKynPQgojQi3s2jgcUWGp/Ebqy1SeCr9VfKQLLU=
github.com/docker/cli-docs-tool v0.10.0/go.mod h1:5EM5zPnT2E7yCLERZmrDA234Vwn09fzRHP4aX1qwp1U=
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=

View File

@ -1,34 +1,38 @@
run:
timeout: 10m
version: "2"
linters:
default: none
enable:
- depguard
- gofmt
- goimports
- revive
- govet
- importas
- ineffassign
- misspell
- typecheck
- errname
- makezero
- whitespace
disable-all: true
linters-settings:
depguard:
settings:
depguard:
rules:
main:
deny:
- pkg: io/ioutil
desc: The io/ioutil package has been deprecated, see https://go.dev/doc/go1.16#ioutil
importas:
no-unaliased: true
exclusions:
generated: lax
rules:
main:
deny:
- pkg: io/ioutil
desc: The io/ioutil package has been deprecated, see https://go.dev/doc/go1.16#ioutil
importas:
no-unaliased: true
- linters:
- revive
text: stutters
formatters:
enable:
- gofmt
- goimports
issues:
exclude-rules:
- linters:
- revive
text: "stutters"
max-issues-per-linter: 0
max-same-issues: 0

View File

@ -14,9 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
ARG GO_VERSION="1.23"
ARG GO_VERSION="1.24"
ARG XX_VERSION="1.6.1"
ARG GOLANGCI_LINT_VERSION="v1.62"
ARG GOLANGCI_LINT_VERSION="v2.1.5"
ARG ADDLICENSE_VERSION="v1.1.1"
ARG LICENSE_ARGS="-c cli-docs-tool -l apache"

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// Package annotation handles annotations for CLI commands.
package annotation
const (

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// Package clidocstool provides tools for generating CLI documentation.
package clidocstool
import (

View File

@ -64,6 +64,14 @@ func (c *Client) genManTreeCustom(cmd *cobra.Command) error {
return nil
}
// Skip hidden command recursively
for curr := cmd; curr != nil; curr = curr.Parent() {
if curr.Hidden {
log.Printf("INFO: Skipping Man for %q (hidden command)", curr.CommandPath())
return nil
}
}
log.Printf("INFO: Generating Man for %q", cmd.CommandPath())
return doc.GenManTreeFromOpts(cmd, doc.GenManTreeOptions{

View File

@ -53,10 +53,12 @@ func (c *Client) GenMarkdownTree(cmd *cobra.Command) error {
return nil
}
// Skip hidden command
if cmd.Hidden {
log.Printf("INFO: Skipping Markdown for %q (hidden command)", cmd.CommandPath())
return nil
// Skip hidden command recursively
for curr := cmd; curr != nil; curr = curr.Parent() {
if curr.Hidden {
log.Printf("INFO: Skipping Markdown for %q (hidden command)", curr.CommandPath())
return nil
}
}
log.Printf("INFO: Generating Markdown for %q", cmd.CommandPath())

View File

@ -169,6 +169,9 @@ func (c *Client) genYamlCustom(cmd *cobra.Command, w io.Writer) error {
// check recursively to handle inherited annotations
for curr := cmd; curr != nil; curr = curr.Parent() {
if curr.Hidden {
cliDoc.Hidden = true
}
if v, ok := curr.Annotations["version"]; ok && cliDoc.MinAPIVersion == "" {
cliDoc.MinAPIVersion = v
}
@ -349,9 +352,9 @@ func genFlagResult(cmd *cobra.Command, flags *pflag.FlagSet, anchors map[string]
//
// This makes the generated YAML more readable, and easier to review changes.
// max can be used to customize the width to keep the whole line < 80 chars.
func forceMultiLine(s string, max int) string {
func forceMultiLine(s string, maxWidth int) string {
s = strings.TrimSpace(s)
if len(s) > max && !strings.Contains(s, "\n") {
if len(s) > maxWidth && !strings.Contains(s, "\n") {
s = s + "\n"
}
return s

4
vendor/modules.txt vendored
View File

@ -40,8 +40,8 @@ github.com/creack/pty
# github.com/distribution/reference v0.6.0
## explicit; go 1.20
github.com/distribution/reference
# github.com/docker/cli-docs-tool v0.9.0
## explicit; go 1.18
# github.com/docker/cli-docs-tool v0.10.0
## explicit; go 1.23.0
github.com/docker/cli-docs-tool
github.com/docker/cli-docs-tool/annotation
# github.com/docker/distribution v2.8.3+incompatible