mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-16 16:37:10 +08:00
docs: update cli-docs-tool to v0.5.0
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
37
vendor/github.com/docker/cli-docs-tool/.golangci.yml
generated
vendored
Normal file
37
vendor/github.com/docker/cli-docs-tool/.golangci.yml
generated
vendored
Normal file
@ -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"
|
86
vendor/github.com/docker/cli-docs-tool/Dockerfile
generated
vendored
Normal file
86
vendor/github.com/docker/cli-docs-tool/Dockerfile
generated
vendored
Normal file
@ -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
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
ARG GO_VERSION="1.18"
|
||||
ARG GOLANGCI_LINT_VERSION="v1.45"
|
||||
ARG ADDLICENSE_VERSION="v1.0.0"
|
||||
|
||||
ARG LICENSE_ARGS="-c cli-docs-tool -l apache"
|
||||
ARG LICENSE_FILES=".*\(Dockerfile\|\.go\|\.hcl\|\.sh\)"
|
||||
|
||||
FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION}-alpine AS golangci-lint
|
||||
FROM ghcr.io/google/addlicense:${ADDLICENSE_VERSION} AS addlicense
|
||||
|
||||
FROM golang:${GO_VERSION}-alpine AS base
|
||||
RUN apk add --no-cache cpio findutils git linux-headers
|
||||
ENV CGO_ENABLED=0
|
||||
WORKDIR /src
|
||||
|
||||
FROM base AS vendored
|
||||
RUN --mount=type=bind,target=.,rw \
|
||||
--mount=type=cache,target=/go/pkg/mod \
|
||||
go mod tidy && go mod download && \
|
||||
mkdir /out && cp go.mod go.sum /out
|
||||
|
||||
FROM scratch AS vendor-update
|
||||
COPY --from=vendored /out /
|
||||
|
||||
FROM vendored AS vendor-validate
|
||||
RUN --mount=type=bind,target=.,rw <<EOT
|
||||
set -e
|
||||
git add -A
|
||||
cp -rf /out/* .
|
||||
diff=$(git status --porcelain -- go.mod go.sum)
|
||||
if [ -n "$diff" ]; then
|
||||
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor"'
|
||||
echo "$diff"
|
||||
exit 1
|
||||
fi
|
||||
EOT
|
||||
|
||||
FROM base AS lint
|
||||
RUN --mount=type=bind,target=. \
|
||||
--mount=type=cache,target=/root/.cache \
|
||||
--mount=from=golangci-lint,source=/usr/bin/golangci-lint,target=/usr/bin/golangci-lint \
|
||||
golangci-lint run ./...
|
||||
|
||||
FROM base AS license-set
|
||||
ARG LICENSE_ARGS
|
||||
ARG LICENSE_FILES
|
||||
RUN --mount=type=bind,target=.,rw \
|
||||
--mount=from=addlicense,source=/app/addlicense,target=/usr/bin/addlicense \
|
||||
find . -regex "${LICENSE_FILES}" | xargs addlicense ${LICENSE_ARGS} \
|
||||
&& mkdir /out \
|
||||
&& find . -regex "${LICENSE_FILES}" | cpio -pdm /out
|
||||
|
||||
FROM scratch AS license-update
|
||||
COPY --from=set /out /
|
||||
|
||||
FROM base AS license-validate
|
||||
ARG LICENSE_ARGS
|
||||
ARG LICENSE_FILES
|
||||
RUN --mount=type=bind,target=. \
|
||||
--mount=from=addlicense,source=/app/addlicense,target=/usr/bin/addlicense \
|
||||
find . -regex "${LICENSE_FILES}" | xargs addlicense -check ${LICENSE_ARGS}
|
||||
|
||||
FROM vendored AS test
|
||||
RUN --mount=type=bind,target=. \
|
||||
--mount=type=cache,target=/root/.cache \
|
||||
--mount=type=cache,target=/go/pkg/mod \
|
||||
go test -v -coverprofile=/tmp/coverage.txt -covermode=atomic ./...
|
||||
|
||||
FROM scratch AS test-coverage
|
||||
COPY --from=test /tmp/coverage.txt /coverage.txt
|
24
vendor/github.com/docker/cli-docs-tool/clidocstool.go
generated
vendored
24
vendor/github.com/docker/cli-docs-tool/clidocstool.go
generated
vendored
@ -18,6 +18,7 @@ import (
|
||||
"errors"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
@ -97,3 +98,26 @@ func copyFile(src string, dst string) error {
|
||||
_, err = io.Copy(df, sf)
|
||||
return err
|
||||
}
|
||||
|
||||
func getAliases(cmd *cobra.Command) []string {
|
||||
if a := cmd.Annotations["aliases"]; a != "" {
|
||||
aliases := strings.Split(a, ",")
|
||||
for i := 0; i < len(aliases); i++ {
|
||||
aliases[i] = strings.TrimSpace(aliases[i])
|
||||
}
|
||||
return aliases
|
||||
}
|
||||
if len(cmd.Aliases) == 0 {
|
||||
return cmd.Aliases
|
||||
}
|
||||
|
||||
var parentPath string
|
||||
if cmd.HasParent() {
|
||||
parentPath = cmd.Parent().CommandPath() + " "
|
||||
}
|
||||
aliases := []string{cmd.CommandPath()}
|
||||
for _, a := range cmd.Aliases {
|
||||
aliases = append(aliases, parentPath+a)
|
||||
}
|
||||
return aliases
|
||||
}
|
||||
|
8
vendor/github.com/docker/cli-docs-tool/clidocstool_md.go
generated
vendored
8
vendor/github.com/docker/cli-docs-tool/clidocstool_md.go
generated
vendored
@ -155,11 +155,9 @@ func mdCmdOutput(cmd *cobra.Command, old string) (string, error) {
|
||||
fmt.Fprintf(b, "%s\n\n", desc)
|
||||
}
|
||||
|
||||
if len(cmd.Aliases) != 0 {
|
||||
fmt.Fprintf(b, "### Aliases\n\n`%s`", cmd.Name())
|
||||
for _, a := range cmd.Aliases {
|
||||
fmt.Fprintf(b, ", `%s`", a)
|
||||
}
|
||||
if aliases := getAliases(cmd); len(aliases) != 0 {
|
||||
fmt.Fprint(b, "### Aliases\n\n")
|
||||
fmt.Fprint(b, "`"+strings.Join(aliases, "`, `")+"`")
|
||||
fmt.Fprint(b, "\n\n")
|
||||
}
|
||||
|
||||
|
4
vendor/github.com/docker/cli-docs-tool/clidocstool_yaml.go
generated
vendored
4
vendor/github.com/docker/cli-docs-tool/clidocstool_yaml.go
generated
vendored
@ -26,7 +26,7 @@ import (
|
||||
"github.com/docker/cli-docs-tool/annotation"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
"gopkg.in/yaml.v2"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
type cmdOption struct {
|
||||
@ -150,7 +150,7 @@ func (c *Client) genYamlCustom(cmd *cobra.Command, w io.Writer) error {
|
||||
|
||||
cliDoc := cmdDoc{
|
||||
Name: cmd.CommandPath(),
|
||||
Aliases: strings.Join(cmd.Aliases, ", "),
|
||||
Aliases: strings.Join(getAliases(cmd), ", "),
|
||||
Short: forceMultiLine(cmd.Short, shortMaxWidth),
|
||||
Long: forceMultiLine(cmd.Long, longMaxWidth),
|
||||
Example: cmd.Example,
|
||||
|
30
vendor/github.com/docker/cli-docs-tool/docker-bake.hcl
generated
vendored
30
vendor/github.com/docker/cli-docs-tool/docker-bake.hcl
generated
vendored
@ -12,10 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
variable "GO_VERSION" {
|
||||
default = "1.16"
|
||||
}
|
||||
|
||||
group "default" {
|
||||
targets = ["test"]
|
||||
}
|
||||
@ -25,49 +21,31 @@ group "validate" {
|
||||
}
|
||||
|
||||
target "lint" {
|
||||
args = {
|
||||
GO_VERSION = GO_VERSION
|
||||
}
|
||||
dockerfile = "./hack/lint.Dockerfile"
|
||||
target = "lint"
|
||||
output = ["type=cacheonly"]
|
||||
}
|
||||
|
||||
target "vendor-validate" {
|
||||
args = {
|
||||
GO_VERSION = GO_VERSION
|
||||
}
|
||||
dockerfile = "./hack/vendor.Dockerfile"
|
||||
target = "validate"
|
||||
target = "vendor-validate"
|
||||
output = ["type=cacheonly"]
|
||||
}
|
||||
|
||||
target "vendor-update" {
|
||||
args = {
|
||||
GO_VERSION = GO_VERSION
|
||||
}
|
||||
dockerfile = "./hack/vendor.Dockerfile"
|
||||
target = "update"
|
||||
target = "vendor-update"
|
||||
output = ["."]
|
||||
}
|
||||
|
||||
target "test" {
|
||||
args = {
|
||||
GO_VERSION = GO_VERSION
|
||||
}
|
||||
dockerfile = "./hack/test.Dockerfile"
|
||||
target = "test-coverage"
|
||||
output = ["."]
|
||||
}
|
||||
|
||||
target "license-validate" {
|
||||
dockerfile = "./hack/license.Dockerfile"
|
||||
target = "validate"
|
||||
target = "license-validate"
|
||||
output = ["type=cacheonly"]
|
||||
}
|
||||
|
||||
target "license-update" {
|
||||
dockerfile = "./hack/license.Dockerfile"
|
||||
target = "update"
|
||||
target = "license-update"
|
||||
output = ["."]
|
||||
}
|
||||
|
Reference in New Issue
Block a user