2017-06-14 16:42:58 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2022-02-25 11:11:04 -05:00
|
|
|
set -eu
|
2017-05-10 21:24:32 -04:00
|
|
|
|
2022-12-29 02:33:11 -05:00
|
|
|
: "${CLI_DOCS_TOOL_VERSION=v0.5.1}"
|
2022-02-25 11:11:04 -05:00
|
|
|
|
|
|
|
export GO111MODULE=auto
|
|
|
|
|
|
|
|
function clean {
|
|
|
|
rm -rf "$buildir"
|
|
|
|
}
|
|
|
|
|
|
|
|
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/tools.go .
|
|
|
|
# update vendor
|
|
|
|
./scripts/vendor update
|
|
|
|
# build docsgen
|
|
|
|
go build -mod=vendor -modfile=vendor.mod -tags docsgen -o /tmp/docsgen ./docs/generate.go
|
|
|
|
)
|
|
|
|
|
|
|
|
mkdir -p docs/yaml
|
|
|
|
set -x
|
2023-01-06 13:04:05 -05:00
|
|
|
/tmp/docsgen --formats yaml --source "$(pwd)/docs/reference/commandline" --target "$(pwd)/docs/yaml"
|