docker/cli-0001-docs-include-required-tools-in-source-tree.patch

23383 lines
708 KiB
Diff
Raw Permalink Normal View History

From 7d5055e48910d7c368d315c22c5b1603cee0aa1f Mon Sep 17 00:00:00 2001
From: danishprakash <danish.prakash@suse.com>
Date: Mon, 12 Feb 2024 18:07:06 +0530
Subject: [PATCH] [PATCH] docs: include required tools in source tree
In order to be able to build the documentation without internet access
(as is required by some distribution build systems), all of the source
code needed for the build needs to be available in the source tarball.
This used to be possible with the docker-cli sources but was
accidentally broken with some CI changes that switched to downloading
the tools (by modifying go.mod as part of the docs build script).
This pattern also maked documentation builds less reproducible since the
tool version used was not based on the source code version.
Fixes: commit 7dc35c03fca5 ("validate manpages target")
Fixes: commit a650f4ddd008 ("switch to cli-docs-tool for yaml docs generation")
Signed-off-by: Aleksa Sarai <asarai@suse.de>
---
docs/generate/go.mod | 13 -
docs/generate/tools.go | 8 -
import.go | 17 +
man/tools.go | 11 -
scripts/docs/generate-man.sh | 33 +-
scripts/docs/generate-md.sh | 36 +-
scripts/docs/generate-yaml.sh | 29 +-
vendor.mod | 5 +
vendor.sum | 4 +
.../cpuguy83/go-md2man/v2/.gitignore | 2 +
.../cpuguy83/go-md2man/v2/.golangci.yml | 6 +
.../cpuguy83/go-md2man/v2/Dockerfile | 20 +
.../cpuguy83/go-md2man/v2/LICENSE.md | 21 +
.../github.com/cpuguy83/go-md2man/v2/Makefile | 35 +
.../cpuguy83/go-md2man/v2/README.md | 15 +
.../cpuguy83/go-md2man/v2/go-md2man.1.md | 28 +
.../cpuguy83/go-md2man/v2/md2man.go | 53 +
.../cpuguy83/go-md2man/v2/md2man/md2man.go | 16 +
.../cpuguy83/go-md2man/v2/md2man/roff.go | 348 ++
.../docker/cli-docs-tool/.dockerignore | 2 +
.../docker/cli-docs-tool/.gitignore | 2 +
.../docker/cli-docs-tool/.golangci.yml | 37 +
.../docker/cli-docs-tool/Dockerfile | 86 +
.../github.com/docker/cli-docs-tool/LICENSE | 202 ++
.../github.com/docker/cli-docs-tool/README.md | 67 +
.../cli-docs-tool/annotation/annotation.go | 25 +
.../docker/cli-docs-tool/clidocstool.go | 123 +
.../docker/cli-docs-tool/clidocstool_md.go | 280 ++
.../docker/cli-docs-tool/clidocstool_yaml.go | 435 +++
.../docker/cli-docs-tool/docker-bake.hcl | 51 +
.../docker/cli-docs-tool/markdown.go | 87 +
.../russross/blackfriday/v2/.gitignore | 8 +
.../russross/blackfriday/v2/.travis.yml | 17 +
.../russross/blackfriday/v2/LICENSE.txt | 29 +
.../russross/blackfriday/v2/README.md | 335 ++
.../russross/blackfriday/v2/block.go | 1612 +++++++++
.../github.com/russross/blackfriday/v2/doc.go | 46 +
.../russross/blackfriday/v2/entities.go | 2236 ++++++++++++
.../github.com/russross/blackfriday/v2/esc.go | 70 +
.../russross/blackfriday/v2/html.go | 952 ++++++
.../russross/blackfriday/v2/inline.go | 1228 +++++++
.../russross/blackfriday/v2/markdown.go | 950 ++++++
.../russross/blackfriday/v2/node.go | 360 ++
.../russross/blackfriday/v2/smartypants.go | 457 +++
vendor/github.com/spf13/cobra/doc/man_docs.go | 246 ++
vendor/github.com/spf13/cobra/doc/md_docs.go | 158 +
.../github.com/spf13/cobra/doc/rest_docs.go | 186 +
vendor/github.com/spf13/cobra/doc/util.go | 52 +
.../github.com/spf13/cobra/doc/yaml_docs.go | 175 +
vendor/gopkg.in/yaml.v3/LICENSE | 50 +
vendor/gopkg.in/yaml.v3/NOTICE | 13 +
vendor/gopkg.in/yaml.v3/README.md | 150 +
vendor/gopkg.in/yaml.v3/apic.go | 747 ++++
vendor/gopkg.in/yaml.v3/decode.go | 1000 ++++++
vendor/gopkg.in/yaml.v3/emitterc.go | 2020 +++++++++++
vendor/gopkg.in/yaml.v3/encode.go | 577 ++++
vendor/gopkg.in/yaml.v3/parserc.go | 1258 +++++++
vendor/gopkg.in/yaml.v3/readerc.go | 434 +++
vendor/gopkg.in/yaml.v3/resolve.go | 326 ++
vendor/gopkg.in/yaml.v3/scannerc.go | 3038 +++++++++++++++++
vendor/gopkg.in/yaml.v3/sorter.go | 134 +
vendor/gopkg.in/yaml.v3/writerc.go | 48 +
vendor/gopkg.in/yaml.v3/yaml.go | 698 ++++
vendor/gopkg.in/yaml.v3/yamlh.go | 807 +++++
vendor/gopkg.in/yaml.v3/yamlprivateh.go | 198 ++
vendor/modules.txt | 15 +
66 files changed, 22631 insertions(+), 96 deletions(-)
delete mode 100644 docs/generate/go.mod
delete mode 100644 docs/generate/tools.go
create mode 100644 import.go
delete mode 100644 man/tools.go
create mode 100644 vendor/github.com/cpuguy83/go-md2man/v2/.gitignore
create mode 100644 vendor/github.com/cpuguy83/go-md2man/v2/.golangci.yml
create mode 100644 vendor/github.com/cpuguy83/go-md2man/v2/Dockerfile
create mode 100644 vendor/github.com/cpuguy83/go-md2man/v2/LICENSE.md
create mode 100644 vendor/github.com/cpuguy83/go-md2man/v2/Makefile
create mode 100644 vendor/github.com/cpuguy83/go-md2man/v2/README.md
create mode 100644 vendor/github.com/cpuguy83/go-md2man/v2/go-md2man.1.md
create mode 100644 vendor/github.com/cpuguy83/go-md2man/v2/md2man.go
create mode 100644 vendor/github.com/cpuguy83/go-md2man/v2/md2man/md2man.go
create mode 100644 vendor/github.com/cpuguy83/go-md2man/v2/md2man/roff.go
create mode 100644 vendor/github.com/docker/cli-docs-tool/.dockerignore
create mode 100644 vendor/github.com/docker/cli-docs-tool/.gitignore
create mode 100644 vendor/github.com/docker/cli-docs-tool/.golangci.yml
create mode 100644 vendor/github.com/docker/cli-docs-tool/Dockerfile
create mode 100644 vendor/github.com/docker/cli-docs-tool/LICENSE
create mode 100644 vendor/github.com/docker/cli-docs-tool/README.md
create mode 100644 vendor/github.com/docker/cli-docs-tool/annotation/annotation.go
create mode 100644 vendor/github.com/docker/cli-docs-tool/clidocstool.go
create mode 100644 vendor/github.com/docker/cli-docs-tool/clidocstool_md.go
create mode 100644 vendor/github.com/docker/cli-docs-tool/clidocstool_yaml.go
create mode 100644 vendor/github.com/docker/cli-docs-tool/docker-bake.hcl
create mode 100644 vendor/github.com/docker/cli-docs-tool/markdown.go
create mode 100644 vendor/github.com/russross/blackfriday/v2/.gitignore
create mode 100644 vendor/github.com/russross/blackfriday/v2/.travis.yml
create mode 100644 vendor/github.com/russross/blackfriday/v2/LICENSE.txt
create mode 100644 vendor/github.com/russross/blackfriday/v2/README.md
create mode 100644 vendor/github.com/russross/blackfriday/v2/block.go
create mode 100644 vendor/github.com/russross/blackfriday/v2/doc.go
create mode 100644 vendor/github.com/russross/blackfriday/v2/entities.go
create mode 100644 vendor/github.com/russross/blackfriday/v2/esc.go
create mode 100644 vendor/github.com/russross/blackfriday/v2/html.go
create mode 100644 vendor/github.com/russross/blackfriday/v2/inline.go
create mode 100644 vendor/github.com/russross/blackfriday/v2/markdown.go
create mode 100644 vendor/github.com/russross/blackfriday/v2/node.go
create mode 100644 vendor/github.com/russross/blackfriday/v2/smartypants.go
create mode 100644 vendor/github.com/spf13/cobra/doc/man_docs.go
create mode 100644 vendor/github.com/spf13/cobra/doc/md_docs.go
create mode 100644 vendor/github.com/spf13/cobra/doc/rest_docs.go
create mode 100644 vendor/github.com/spf13/cobra/doc/util.go
create mode 100644 vendor/github.com/spf13/cobra/doc/yaml_docs.go
create mode 100644 vendor/gopkg.in/yaml.v3/LICENSE
create mode 100644 vendor/gopkg.in/yaml.v3/NOTICE
create mode 100644 vendor/gopkg.in/yaml.v3/README.md
create mode 100644 vendor/gopkg.in/yaml.v3/apic.go
create mode 100644 vendor/gopkg.in/yaml.v3/decode.go
create mode 100644 vendor/gopkg.in/yaml.v3/emitterc.go
create mode 100644 vendor/gopkg.in/yaml.v3/encode.go
create mode 100644 vendor/gopkg.in/yaml.v3/parserc.go
create mode 100644 vendor/gopkg.in/yaml.v3/readerc.go
create mode 100644 vendor/gopkg.in/yaml.v3/resolve.go
create mode 100644 vendor/gopkg.in/yaml.v3/scannerc.go
create mode 100644 vendor/gopkg.in/yaml.v3/sorter.go
create mode 100644 vendor/gopkg.in/yaml.v3/writerc.go
create mode 100644 vendor/gopkg.in/yaml.v3/yaml.go
create mode 100644 vendor/gopkg.in/yaml.v3/yamlh.go
create mode 100644 vendor/gopkg.in/yaml.v3/yamlprivateh.go
diff --git a/docs/generate/go.mod b/docs/generate/go.mod
deleted file mode 100644
index d62ff455713a..000000000000
--- a/docs/generate/go.mod
+++ /dev/null
@@ -1,13 +0,0 @@
-module github.com/docker/cli/docs/generate
-
-// dummy go.mod to avoid dealing with dependencies specific
-// to docs generation and not really part of the project.
-
-go 1.16
-
-//require (
-// github.com/docker/cli v0.0.0+incompatible
-// github.com/docker/cli-docs-tool v0.5.0
-//)
-//
-//replace github.com/docker/cli v0.0.0+incompatible => ../../
diff --git a/docs/generate/tools.go b/docs/generate/tools.go
deleted file mode 100644
index 47510bc49a89..000000000000
--- a/docs/generate/tools.go
+++ /dev/null
@@ -1,8 +0,0 @@
-//go:build tools
-// +build tools
-
-package main
-
-import (
- _ "github.com/docker/cli-docs-tool"
-)
diff --git a/import.go b/import.go
new file mode 100644
index 000000000000..662a6055146c
--- /dev/null
+++ b/import.go
@@ -0,0 +1,17 @@
+// This is only used to define imports we need for doc generation.
+
+//go:build never
+// +build never
+
+package cli
+
+import (
+ // Used for md and yaml doc generation.
+ _ "github.com/docker/cli-docs-tool"
+
+ // Used for man page generation.
+ _ "github.com/cpuguy83/go-md2man/v2"
+ _ "github.com/spf13/cobra"
+ _ "github.com/spf13/cobra/doc"
+ _ "github.com/spf13/pflag"
+)
diff --git a/man/tools.go b/man/tools.go
deleted file mode 100644
index 3cafe6533aff..000000000000
--- a/man/tools.go
+++ /dev/null
@@ -1,11 +0,0 @@
-//go:build tools
-// +build tools
-
-package main
-
-import (
- _ "github.com/cpuguy83/go-md2man/v2"
- _ "github.com/spf13/cobra"
- _ "github.com/spf13/cobra/doc"
- _ "github.com/spf13/pflag"
-)
diff --git a/scripts/docs/generate-man.sh b/scripts/docs/generate-man.sh
index 12a4b81199db..1e12a95e9c9a 100755
--- a/scripts/docs/generate-man.sh
+++ b/scripts/docs/generate-man.sh
@@ -1,35 +1,22 @@
#!/usr/bin/env bash
-set -eu
-
-: "${MD2MAN_VERSION=v2.0.3}"
+set -Eeuo pipefail
export GO111MODULE=auto
-function clean {
- rm -rf "$buildir"
+# temporary "go.mod" to make -modfile= work
+touch go.mod
+
+function clean() {
+ rm -f "$(pwd)/go.mod"
}
-buildir=$(mktemp -d -t docker-cli-docsgen.XXXXXXXXXX)
trap clean EXIT
-(
- set -x
- cp -r . "$buildir/"
- cd "$buildir"
- # init dummy go.mod
- ./scripts/vendor init
- # install go-md2man and copy man/tools.go in root folder
- # to be able to fetch the required dependencies
- go mod edit -modfile=vendor.mod -require=github.com/cpuguy83/go-md2man/v2@${MD2MAN_VERSION}
- cp man/tools.go .
- # update vendor
- ./scripts/vendor update
- # build gen-manpages
- go build -mod=vendor -modfile=vendor.mod -tags manpages -o /tmp/gen-manpages ./man/generate.go
- # build go-md2man
- go build -mod=vendor -modfile=vendor.mod -o /tmp/go-md2man ./vendor/github.com/cpuguy83/go-md2man/v2
-)
+# build gen-manpages
+go build -mod=vendor -modfile=vendor.mod -tags manpages -o /tmp/gen-manpages ./man/generate.go
+# build go-md2man
+go build -mod=vendor -modfile=vendor.mod -o /tmp/go-md2man ./vendor/github.com/cpuguy83/go-md2man/v2
mkdir -p man/man1
(set -x ; /tmp/gen-manpages --root "." --target "$(pwd)/man/man1")
diff --git a/scripts/docs/generate-md.sh b/scripts/docs/generate-md.sh
index 4caa01eaed23..0af86843bbe4 100755
--- a/scripts/docs/generate-md.sh
+++ b/scripts/docs/generate-md.sh
@@ -1,33 +1,29 @@
#!/usr/bin/env bash
-set -eu
-
-: "${CLI_DOCS_TOOL_VERSION=v0.7.0}"
+set -Eeuo pipefail
export GO111MODULE=auto
+# temporary "go.mod" to make -modfile= work
+touch go.mod
+
function clean {
- rm -rf "$buildir"
+ rm -f "$(pwd)/go.mod"
+ if [ -f "$(pwd)/docs/reference/commandline/docker.md" ]; then
+ mv "$(pwd)/docs/reference/commandline/docker.md" "$(pwd)/docs/reference/commandline/cli.md"
+ fi
}
-buildir=$(mktemp -d -t docker-cli-docsgen.XXXXXXXXXX)
trap clean EXIT
-(
- set -x
- cp -r . "$buildir/"
- cd "$buildir"
- # init dummy go.mod
- ./scripts/vendor init
- # install cli-docs-tool and copy docs/tools.go in root folder
- # to be able to fetch the required depedencies
- go mod edit -modfile=vendor.mod -require=github.com/docker/cli-docs-tool@${CLI_DOCS_TOOL_VERSION}
- cp docs/generate/tools.go .
- # update vendor
- ./scripts/vendor update
- # build docsgen
- go build -mod=vendor -modfile=vendor.mod -tags docsgen -o /tmp/docsgen ./docs/generate/generate.go
-)
+# build docsgen
+go build -mod=vendor -modfile=vendor.mod -tags docsgen -o /tmp/docsgen ./docs/generate/generate.go
+
+# yaml generation on docs repo needs the cli.md file: https://github.com/docker/cli/pull/3924#discussion_r1059986605
+# but markdown generation docker.md atm. While waiting for a fix in cli-docs-tool
+# we need to first move the cli.md file to docker.md, do the generation and
+# then move it back in trap handler.
+mv "$(pwd)/docs/reference/commandline/cli.md" "$(pwd)/docs/reference/commandline/docker.md"
(
set -x
diff --git a/scripts/docs/generate-yaml.sh b/scripts/docs/generate-yaml.sh
index 0d67c5e5bb09..7d98e161df5d 100755
--- a/scripts/docs/generate-yaml.sh
+++ b/scripts/docs/generate-yaml.sh
@@ -1,33 +1,20 @@
#!/usr/bin/env bash
-set -eu
-
-: "${CLI_DOCS_TOOL_VERSION=v0.7.0}"
+set -Eeuo pipefail
export GO111MODULE=auto
-function clean {
- rm -rf "$buildir"
+# temporary "go.mod" to make -modfile= work
+touch go.mod
+
+function clean() {
+ rm -f "$(pwd)/go.mod"
}
-buildir=$(mktemp -d -t docker-cli-docsgen.XXXXXXXXXX)
trap clean EXIT
-(
- set -x
- cp -r . "$buildir/"
- cd "$buildir"
- # init dummy go.mod
- ./scripts/vendor init
- # install cli-docs-tool and copy docs/tools.go in root folder
- # to be able to fetch the required depedencies
- go mod edit -modfile=vendor.mod -require=github.com/docker/cli-docs-tool@${CLI_DOCS_TOOL_VERSION}
- cp docs/generate/tools.go .
- # update vendor
- ./scripts/vendor update
- # build docsgen
- go build -mod=vendor -modfile=vendor.mod -tags docsgen -o /tmp/docsgen ./docs/generate/generate.go
-)
+# build docsgen
+go build -mod=vendor -modfile=vendor.mod -tags docsgen -o /tmp/docsgen ./docs/generate/generate.go
mkdir -p docs/yaml
set -x
diff --git a/vendor.mod b/vendor.mod
index cb538723603a..ba34bb097a32 100644
--- a/vendor.mod
+++ b/vendor.mod
@@ -11,6 +11,7 @@ require (
github.com/containerd/containerd v1.7.12
github.com/creack/pty v1.1.21
github.com/distribution/reference v0.5.0
+ github.com/docker/cli-docs-tool v0.6.0
github.com/docker/distribution v2.8.3+incompatible
github.com/docker/docker v25.0.5-0.20240319141229-e63daec8672d+incompatible // 25.0 branch (v25.0.5-dev)
github.com/docker/docker-credential-helpers v0.8.1
@@ -46,6 +47,8 @@ require (
tags.cncf.io/container-device-interface v0.6.2
)
+require github.com/cpuguy83/go-md2man/v2 v2.0.3
+
require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
@@ -72,6 +75,7 @@ require (
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
+ github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
go.etcd.io/etcd/raft/v3 v3.5.6 // indirect
@@ -87,4 +91,5 @@ require (
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect
google.golang.org/grpc v1.58.3 // indirect
google.golang.org/protobuf v1.31.0 // indirect
+ gopkg.in/yaml.v3 v3.0.1 // indirect
)
diff --git a/vendor.sum b/vendor.sum
index 064239b2fa8f..ca83ab55f00a 100644
--- a/vendor.sum
+++ b/vendor.sum
@@ -41,6 +41,7 @@ github.com/containerd/containerd v1.7.12/go.mod h1:/5OMpE1p0ylxtEUGY8kuCYkDRzJm9
github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I=
github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo=
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
+github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM=
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.21 h1:1/QdRyBaHHJP61QkWMXlOIBfsgdDeeKfK8SYVUWJKf0=
@@ -51,6 +52,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.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0=
github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
+github.com/docker/cli-docs-tool v0.6.0 h1:Z9x10SaZgFaB6jHgz3OWooynhSa40CsWkpe5hEnG/qA=
+github.com/docker/cli-docs-tool v0.6.0/go.mod h1:zMjqTFCU361PRh8apiXzeAZ1Q/xupbIwTusYpzCXS/o=
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=
@@ -227,6 +230,7 @@ github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJf
github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
+github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
diff --git a/vendor/github.com/cpuguy83/go-md2man/v2/.gitignore b/vendor/github.com/cpuguy83/go-md2man/v2/.gitignore
new file mode 100644
index 000000000000..30f97c3d73ab
--- /dev/null
+++ b/vendor/github.com/cpuguy83/go-md2man/v2/.gitignore
@@ -0,0 +1,2 @@
+go-md2man
+bin
diff --git a/vendor/github.com/cpuguy83/go-md2man/v2/.golangci.yml b/vendor/github.com/cpuguy83/go-md2man/v2/.golangci.yml
new file mode 100644
index 000000000000..71f073f3c6b9
--- /dev/null
+++ b/vendor/github.com/cpuguy83/go-md2man/v2/.golangci.yml
@@ -0,0 +1,6 @@
+# For documentation, see https://golangci-lint.run/usage/configuration/
+
+linters:
+ enable:
+ - gofumpt
+
diff --git a/vendor/github.com/cpuguy83/go-md2man/v2/Dockerfile b/vendor/github.com/cpuguy83/go-md2man/v2/Dockerfile
new file mode 100644
index 000000000000..7181c5306f41
--- /dev/null
+++ b/vendor/github.com/cpuguy83/go-md2man/v2/Dockerfile
@@ -0,0 +1,20 @@
+ARG GO_VERSION=1.18
+ARG GO_IMAGE=golang:${GO_VERSION}
+
+FROM --platform=$BUILDPLATFORM $GO_IMAGE AS build
+COPY . /go/src/github.com/cpuguy83/go-md2man
+WORKDIR /go/src/github.com/cpuguy83/go-md2man
+ARG TARGETOS
+ARG TARGETARCH
+ARG TARGETVARIANT
+RUN \
+ export GOOS="${TARGETOS}"; \
+ export GOARCH="${TARGETARCH}"; \
+ if [ "${TARGETARCH}" = "arm" ] && [ "${TARGETVARIANT}" ]; then \
+ export GOARM="${TARGETVARIANT#v}"; \
+ fi; \
+ CGO_ENABLED=0 go build
+
+FROM scratch
+COPY --from=build /go/src/github.com/cpuguy83/go-md2man/go-md2man /go-md2man
+ENTRYPOINT ["/go-md2man"]
diff --git a/vendor/github.com/cpuguy83/go-md2man/v2/LICENSE.md b/vendor/github.com/cpuguy83/go-md2man/v2/LICENSE.md
new file mode 100644
index 000000000000..1cade6cef6a1
--- /dev/null
+++ b/vendor/github.com/cpuguy83/go-md2man/v2/LICENSE.md
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014 Brian Goff
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/vendor/github.com/cpuguy83/go-md2man/v2/Makefile b/vendor/github.com/cpuguy83/go-md2man/v2/Makefile
new file mode 100644
index 000000000000..437fc9997926
--- /dev/null
+++ b/vendor/github.com/cpuguy83/go-md2man/v2/Makefile
@@ -0,0 +1,35 @@
+GO111MODULE ?= on
+LINTER_BIN ?= golangci-lint
+
+export GO111MODULE
+
+.PHONY:
+build: bin/go-md2man
+
+.PHONY: clean
+clean:
+ @rm -rf bin/*
+
+.PHONY: test
+test:
+ @go test $(TEST_FLAGS) ./...
+
+bin/go-md2man: actual_build_flags := $(BUILD_FLAGS) -o bin/go-md2man
+bin/go-md2man: bin
+ @CGO_ENABLED=0 go build $(actual_build_flags)
+
+bin:
+ @mkdir ./bin
+
+.PHONY: mod
+mod:
+ @go mod tidy
+
+.PHONY: check-mod
+check-mod: # verifies that module changes for go.mod and go.sum are checked in
+ @hack/ci/check_mods.sh
+
+.PHONY: vendor
+vendor: mod
+ @go mod vendor -v
+
diff --git a/vendor/github.com/cpuguy83/go-md2man/v2/README.md b/vendor/github.com/cpuguy83/go-md2man/v2/README.md
new file mode 100644
index 000000000000..0e30d341483c
--- /dev/null
+++ b/vendor/github.com/cpuguy83/go-md2man/v2/README.md
@@ -0,0 +1,15 @@
+go-md2man
+=========
+
+Converts markdown into roff (man pages).
+
+Uses blackfriday to process markdown into man pages.
+
+### Usage
+
+./md2man -in /path/to/markdownfile.md -out /manfile/output/path
+
+### How to contribute
+
+We use go modules to manage dependencies.
+As such you must be using at lest go1.11.
diff --git a/vendor/github.com/cpuguy83/go-md2man/v2/go-md2man.1.md b/vendor/github.com/cpuguy83/go-md2man/v2/go-md2man.1.md
new file mode 100644
index 000000000000..aa4587e279ff
--- /dev/null
+++ b/vendor/github.com/cpuguy83/go-md2man/v2/go-md2man.1.md
@@ -0,0 +1,28 @@
+go-md2man 1 "January 2015" go-md2man "User Manual"
+==================================================
+
+# NAME
+go-md2man - Convert markdown files into manpages
+
+# SYNOPSIS
+**go-md2man** [**-in**=*/path/to/md/file*] [**-out**=*/path/to/output*]
+
+# DESCRIPTION
+**go-md2man** converts standard markdown formatted documents into manpages. It is
+written purely in Go so as to reduce dependencies on 3rd party libs.
+
+By default, the input is stdin and the output is stdout.
+
+# EXAMPLES
+Convert the markdown file *go-md2man.1.md* into a manpage:
+```
+go-md2man < go-md2man.1.md > go-md2man.1
+```
+
+Same, but using command line arguments instead of shell redirection:
+```
+go-md2man -in=go-md2man.1.md -out=go-md2man.1
+```
+
+# HISTORY
+January 2015, Originally compiled by Brian Goff (cpuguy83@gmail.com).
diff --git a/vendor/github.com/cpuguy83/go-md2man/v2/md2man.go b/vendor/github.com/cpuguy83/go-md2man/v2/md2man.go
new file mode 100644
index 000000000000..4ff873b8e767
--- /dev/null
+++ b/vendor/github.com/cpuguy83/go-md2man/v2/md2man.go
@@ -0,0 +1,53 @@
+package main
+
+import (
+ "flag"
+ "fmt"
+ "io/ioutil"
+ "os"
+
+ "github.com/cpuguy83/go-md2man/v2/md2man"
+)
+
+var (
+ inFilePath = flag.String("in", "", "Path to file to be processed (default: stdin)")
+ outFilePath = flag.String("out", "", "Path to output processed file (default: stdout)")
+)
+
+func main() {
+ var err error
+ flag.Parse()
+
+ inFile := os.Stdin
+ if *inFilePath != "" {
+ inFile, err = os.Open(*inFilePath)
+ if err != nil {
+ fmt.Println(err)
+ os.Exit(1)
+ }
+ }
+ defer inFile.Close() // nolint: errcheck
+
+ doc, err := ioutil.ReadAll(inFile)
+ if err != nil {
+ fmt.Println(err)
+ os.Exit(1)
+ }
+
+ out := md2man.Render(doc)
+
+ outFile := os.Stdout
+ if *outFilePath != "" {
+ outFile, err = os.Create(*outFilePath)
+ if err != nil {
+ fmt.Println(err)
+ os.Exit(1)
+ }
+ defer outFile.Close() // nolint: errcheck
+ }
+ _, err = outFile.Write(out)
+ if err != nil {
+ fmt.Println(err)
+ os.Exit(1)
+ }
+}
diff --git a/vendor/github.com/cpuguy83/go-md2man/v2/md2man/md2man.go b/vendor/github.com/cpuguy83/go-md2man/v2/md2man/md2man.go
new file mode 100644
index 000000000000..42bf32aab003
--- /dev/null
+++ b/vendor/github.com/cpuguy83/go-md2man/v2/md2man/md2man.go
@@ -0,0 +1,16 @@
+package md2man
+
+import (
+ "github.com/russross/blackfriday/v2"
+)
+
+// Render converts a markdown document into a roff formatted document.
+func Render(doc []byte) []byte {
+ renderer := NewRoffRenderer()
+
+ return blackfriday.Run(doc,
+ []blackfriday.Option{
+ blackfriday.WithRenderer(renderer),
+ blackfriday.WithExtensions(renderer.GetExtensions()),
+ }...)
+}
diff --git a/vendor/github.com/cpuguy83/go-md2man/v2/md2man/roff.go b/vendor/github.com/cpuguy83/go-md2man/v2/md2man/roff.go
new file mode 100644
index 000000000000..4b19188d90fd
--- /dev/null
+++ b/vendor/github.com/cpuguy83/go-md2man/v2/md2man/roff.go
@@ -0,0 +1,348 @@
+package md2man
+
+import (
+ "bytes"
+ "fmt"
+ "io"
+ "os"
+ "strings"
+
+ "github.com/russross/blackfriday/v2"
+)
+
+// roffRenderer implements the blackfriday.Renderer interface for creating
+// roff format (manpages) from markdown text
+type roffRenderer struct {
+ extensions blackfriday.Extensions
+ listCounters []int
+ firstHeader bool
+ firstDD bool
+ listDepth int
+}
+
+const (
+ titleHeader = ".TH "
+ topLevelHeader = "\n\n.SH "
+ secondLevelHdr = "\n.SH "
+ otherHeader = "\n.SS "
+ crTag = "\n"
+ emphTag = "\\fI"
+ emphCloseTag = "\\fP"
+ strongTag = "\\fB"
+ strongCloseTag = "\\fP"
+ breakTag = "\n.br\n"
+ paraTag = "\n.PP\n"
+ hruleTag = "\n.ti 0\n\\l'\\n(.lu'\n"
+ linkTag = "\n\\[la]"
+ linkCloseTag = "\\[ra]"
+ codespanTag = "\\fB"
+ codespanCloseTag = "\\fR"
+ codeTag = "\n.EX\n"
+ codeCloseTag = "\n.EE\n"
+ quoteTag = "\n.PP\n.RS\n"
+ quoteCloseTag = "\n.RE\n"
+ listTag = "\n.RS\n"
+ listCloseTag = "\n.RE\n"
+ dtTag = "\n.TP\n"
+ dd2Tag = "\n"
+ tableStart = "\n.TS\nallbox;\n"
+ tableEnd = ".TE\n"
+ tableCellStart = "T{\n"
+ tableCellEnd = "\nT}\n"
+)
+
+// NewRoffRenderer creates a new blackfriday Renderer for generating roff documents
+// from markdown
+func NewRoffRenderer() *roffRenderer { // nolint: golint
+ var extensions blackfriday.Extensions
+
+ extensions |= blackfriday.NoIntraEmphasis
+ extensions |= blackfriday.Tables
+ extensions |= blackfriday.FencedCode
+ extensions |= blackfriday.SpaceHeadings
+ extensions |= blackfriday.Footnotes
+ extensions |= blackfriday.Titleblock
+ extensions |= blackfriday.DefinitionLists
+ return &roffRenderer{
+ extensions: extensions,
+ }
+}
+
+// GetExtensions returns the list of extensions used by this renderer implementation
+func (r *roffRenderer) GetExtensions() blackfriday.Extensions {
+ return r.extensions
+}
+
+// RenderHeader handles outputting the header at document start
+func (r *roffRenderer) RenderHeader(w io.Writer, ast *blackfriday.Node) {
+ // disable hyphenation
+ out(w, ".nh\n")
+}
+
+// RenderFooter handles outputting the footer at the document end; the roff
+// renderer has no footer information
+func (r *roffRenderer) RenderFooter(w io.Writer, ast *blackfriday.Node) {
+}
+
+// RenderNode is called for each node in a markdown document; based on the node
+// type the equivalent roff output is sent to the writer
+func (r *roffRenderer) RenderNode(w io.Writer, node *blackfriday.Node, entering bool) blackfriday.WalkStatus {
+ walkAction := blackfriday.GoToNext
+
+ switch node.Type {
+ case blackfriday.Text:
+ escapeSpecialChars(w, node.Literal)
+ case blackfriday.Softbreak:
+ out(w, crTag)
+ case blackfriday.Hardbreak:
+ out(w, breakTag)
+ case blackfriday.Emph:
+ if entering {
+ out(w, emphTag)
+ } else {
+ out(w, emphCloseTag)
+ }
+ case blackfriday.Strong:
+ if entering {
+ out(w, strongTag)
+ } else {
+ out(w, strongCloseTag)
+ }
+ case blackfriday.Link:
+ // Don't render the link text for automatic links, because this
+ // will only duplicate the URL in the roff output.
+ // See https://daringfireball.net/projects/markdown/syntax#autolink
+ if !bytes.Equal(node.LinkData.Destination, node.FirstChild.Literal) {
+ out(w, string(node.FirstChild.Literal))
+ }
+ // Hyphens in a link must be escaped to avoid word-wrap in the rendered man page.
+ escapedLink := strings.ReplaceAll(string(node.LinkData.Destination), "-", "\\-")
+ out(w, linkTag+escapedLink+linkCloseTag)
+ walkAction = blackfriday.SkipChildren
+ case blackfriday.Image:
+ // ignore images
+ walkAction = blackfriday.SkipChildren
+ case blackfriday.Code:
+ out(w, codespanTag)
+ escapeSpecialChars(w, node.Literal)
+ out(w, codespanCloseTag)
+ case blackfriday.Document:
+ break
+ case blackfriday.Paragraph:
+ // roff .PP markers break lists
+ if r.listDepth > 0 {
+ return blackfriday.GoToNext
+ }
+ if entering {
+ out(w, paraTag)
+ } else {
+ out(w, crTag)
+ }
+ case blackfriday.BlockQuote:
+ if entering {
+ out(w, quoteTag)
+ } else {
+ out(w, quoteCloseTag)
+ }
+ case blackfriday.Heading:
+ r.handleHeading(w, node, entering)
+ case blackfriday.HorizontalRule:
+ out(w, hruleTag)
+ case blackfriday.List:
+ r.handleList(w, node, entering)
+ case blackfriday.Item:
+ r.handleItem(w, node, entering)
+ case blackfriday.CodeBlock:
+ out(w, codeTag)
+ escapeSpecialChars(w, node.Literal)
+ out(w, codeCloseTag)
+ case blackfriday.Table:
+ r.handleTable(w, node, entering)
+ case blackfriday.TableHead:
+ case blackfriday.TableBody:
+ case blackfriday.TableRow:
+ // no action as cell entries do all the nroff formatting
+ return blackfriday.GoToNext
+ case blackfriday.TableCell:
+ r.handleTableCell(w, node, entering)
+ case blackfriday.HTMLSpan:
+ // ignore other HTML tags
+ case blackfriday.HTMLBlock:
+ if bytes.HasPrefix(node.Literal, []byte("<!--")) {
+ break // ignore comments, no warning
+ }
+ fmt.Fprintln(os.Stderr, "WARNING: go-md2man does not handle node type "+node.Type.String())
+ default:
+ fmt.Fprintln(os.Stderr, "WARNING: go-md2man does not handle node type "+node.Type.String())
+ }
+ return walkAction
+}
+
+func (r *roffRenderer) handleHeading(w io.Writer, node *blackfriday.Node, entering bool) {
+ if entering {
+ switch node.Level {
+ case 1:
+ if !r.firstHeader {
+ out(w, titleHeader)
+ r.firstHeader = true
+ break
+ }
+ out(w, topLevelHeader)
+ case 2:
+ out(w, secondLevelHdr)
+ default:
+ out(w, otherHeader)
+ }
+ }
+}
+
+func (r *roffRenderer) handleList(w io.Writer, node *blackfriday.Node, entering bool) {
+ openTag := listTag
+ closeTag := listCloseTag
+ if node.ListFlags&blackfriday.ListTypeDefinition != 0 {
+ // tags for definition lists handled within Item node
+ openTag = ""
+ closeTag = ""
+ }
+ if entering {
+ r.listDepth++
+ if node.ListFlags&blackfriday.ListTypeOrdered != 0 {
+ r.listCounters = append(r.listCounters, 1)
+ }
+ out(w, openTag)
+ } else {
+ if node.ListFlags&blackfriday.ListTypeOrdered != 0 {
+ r.listCounters = r.listCounters[:len(r.listCounters)-1]
+ }
+ out(w, closeTag)
+ r.listDepth--
+ }
+}
+
+func (r *roffRenderer) handleItem(w io.Writer, node *blackfriday.Node, entering bool) {
+ if entering {
+ if node.ListFlags&blackfriday.ListTypeOrdered != 0 {
+ out(w, fmt.Sprintf(".IP \"%3d.\" 5\n", r.listCounters[len(r.listCounters)-1]))
+ r.listCounters[len(r.listCounters)-1]++
+ } else if node.ListFlags&blackfriday.ListTypeTerm != 0 {
+ // DT (definition term): line just before DD (see below).
+ out(w, dtTag)
+ r.firstDD = true
+ } else if node.ListFlags&blackfriday.ListTypeDefinition != 0 {
+ // DD (definition description): line that starts with ": ".
+ //
+ // We have to distinguish between the first DD and the
+ // subsequent ones, as there should be no vertical
+ // whitespace between the DT and the first DD.
+ if r.firstDD {
+ r.firstDD = false
+ } else {
+ out(w, dd2Tag)
+ }
+ } else {
+ out(w, ".IP \\(bu 2\n")
+ }
+ } else {
+ out(w, "\n")
+ }
+}
+
+func (r *roffRenderer) handleTable(w io.Writer, node *blackfriday.Node, entering bool) {
+ if entering {
+ out(w, tableStart)
+ // call walker to count cells (and rows?) so format section can be produced
+ columns := countColumns(node)
+ out(w, strings.Repeat("l ", columns)+"\n")
+ out(w, strings.Repeat("l ", columns)+".\n")
+ } else {
+ out(w, tableEnd)
+ }
+}
+
+func (r *roffRenderer) handleTableCell(w io.Writer, node *blackfriday.Node, entering bool) {
+ if entering {
+ var start string
+ if node.Prev != nil && node.Prev.Type == blackfriday.TableCell {
+ start = "\t"
+ }
+ if node.IsHeader {
+ start += strongTag
+ } else if nodeLiteralSize(node) > 30 {
+ start += tableCellStart
+ }
+ out(w, start)
+ } else {
+ var end string
+ if node.IsHeader {
+ end = strongCloseTag
+ } else if nodeLiteralSize(node) > 30 {
+ end = tableCellEnd
+ }
+ if node.Next == nil && end != tableCellEnd {
+ // Last cell: need to carriage return if we are at the end of the
+ // header row and content isn't wrapped in a "tablecell"
+ end += crTag
+ }
+ out(w, end)
+ }
+}
+
+func nodeLiteralSize(node *blackfriday.Node) int {
+ total := 0
+ for n := node.FirstChild; n != nil; n = n.FirstChild {
+ total += len(n.Literal)
+ }
+ return total
+}
+
+// because roff format requires knowing the column count before outputting any table
+// data we need to walk a table tree and count the columns
+func countColumns(node *blackfriday.Node) int {
+ var columns int
+
+ node.Walk(func(node *blackfriday.Node, entering bool) blackfriday.WalkStatus {
+ switch node.Type {
+ case blackfriday.TableRow:
+ if !entering {
+ return blackfriday.Terminate
+ }
+ case blackfriday.TableCell:
+ if entering {
+ columns++
+ }
+ default:
+ }
+ return blackfriday.GoToNext
+ })
+ return columns
+}
+
+func out(w io.Writer, output string) {
+ io.WriteString(w, output) // nolint: errcheck
+}
+
+func escapeSpecialChars(w io.Writer, text []byte) {
+ for i := 0; i < len(text); i++ {
+ // escape initial apostrophe or period
+ if len(text) >= 1 && (text[0] == '\'' || text[0] == '.') {
+ out(w, "\\&")
+ }
+
+ // directly copy normal characters
+ org := i
+
+ for i < len(text) && text[i] != '\\' {
+ i++
+ }
+ if i > org {
+ w.Write(text[org:i]) // nolint: errcheck
+ }
+
+ // escape a character
+ if i >= len(text) {
+ break
+ }
+
+ w.Write([]byte{'\\', text[i]}) // nolint: errcheck
+ }
+}
diff --git a/vendor/github.com/docker/cli-docs-tool/.dockerignore b/vendor/github.com/docker/cli-docs-tool/.dockerignore
new file mode 100644
index 000000000000..c8c323c89663
--- /dev/null
+++ b/vendor/github.com/docker/cli-docs-tool/.dockerignore
@@ -0,0 +1,2 @@
+/coverage.txt
+/example/docs
diff --git a/vendor/github.com/docker/cli-docs-tool/.gitignore b/vendor/github.com/docker/cli-docs-tool/.gitignore
new file mode 100644
index 000000000000..c8c323c89663
--- /dev/null
+++ b/vendor/github.com/docker/cli-docs-tool/.gitignore
@@ -0,0 +1,2 @@
+/coverage.txt
+/example/docs
diff --git a/vendor/github.com/docker/cli-docs-tool/.golangci.yml b/vendor/github.com/docker/cli-docs-tool/.golangci.yml
new file mode 100644
index 000000000000..6c6557176b28
--- /dev/null
+++ b/vendor/github.com/docker/cli-docs-tool/.golangci.yml
@@ -0,0 +1,37 @@
+run:
+ timeout: 10m
+
+linters:
+ enable:
+ - deadcode
+ - depguard
+ - gofmt
+ - goimports
+ - revive
+ - govet
+ - importas
+ - ineffassign
+ - misspell
+ - typecheck
+ - varcheck
+ - errname
+ - makezero
+ - whitespace
+ disable-all: true
+
+linters-settings:
+ depguard:
+ list-type: blacklist
+ include-go-root: true
+ packages:
+ # The io/ioutil package has been deprecated.
+ # https://go.dev/doc/go1.16#ioutil
+ - io/ioutil
+ importas:
+ no-unaliased: true
+
+issues:
+ exclude-rules:
+ - linters:
+ - revive
+ text: "stutters"
diff --git a/vendor/github.com/docker/cli-docs-tool/Dockerfile b/vendor/github.com/docker/cli-docs-tool/Dockerfile
new file mode 100644
index 000000000000..f0e2739faa7c
--- /dev/null
+++ b/vendor/github.com/docker/cli-docs-tool/Dockerfile
@@ -0,0 +1,86 @@
+# syntax=docker/dockerfile:1
+
+# Copyright 2021 cli-docs-tool authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#