bazel: add cli doc generation to //:generate

Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
Paul Meyer 2023-03-30 11:30:03 +02:00
parent 8489516208
commit e021245660
3 changed files with 34 additions and 55 deletions

View file

@ -381,6 +381,17 @@ multirun(
jobs = 0, # execute concurrently
)
sh_template(
name = "cli_docgen",
data = [
"//hack/clidocgen",
],
substitutions = {
"@@CLIDOCGEN@@": "$(rootpath //hack/clidocgen:clidocgen)",
},
template = "cli_docgen.sh.in",
)
multirun(
name = "tidy",
commands = [
@ -432,6 +443,7 @@ multirun(
"//3rdparty/bazel/com_github_medik8s_node_maintainance_operator:pull_files",
":go_generate",
":proto_generate",
":cli_docgen",
],
jobs = 1, # execute sequentially
visibility = ["//visibility:public"],

22
bazel/ci/cli_docgen.sh.in Normal file
View file

@ -0,0 +1,22 @@
#!/usr/bin/env bash
###### script header ######
lib=$(realpath @@BASE_LIB@@) || exit 1
stat "${lib}" >> /dev/null || exit 1
# shellcheck source=../sh/lib.bash
if ! source "${lib}"; then
echo "Error: could not find import"
exit 1
fi
clidocgen=$(realpath @@CLIDOCGEN@@)
stat "${clidocgen}" >> /dev/null
cd "${BUILD_WORKSPACE_DIRECTORY}"
###### script body ######
cd hack/clidocgen
${clidocgen} | cat header.md - > ../../docs/docs/reference/cli.md