Keep frontmatter for docker, dockerd and index markdown files. Also needs to move cli.md > docker.md before generation and then move it back because cli.md is needed for yaml generation on docs website: https://github.com/docker/cli/pull/3924#discussion_r1059986605 Signed-off-by: Kevin Alvarez <crazy-max@users.noreply.github.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
35 lines
816 B
Bash
Executable File
35 lines
816 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -eu
|
|
|
|
: "${CLI_DOCS_TOOL_VERSION=v0.5.1}"
|
|
|
|
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
|
|
/tmp/docsgen --formats yaml --source "$(pwd)/docs/reference/commandline" --target "$(pwd)/docs/yaml"
|