1 Star 0 Fork 0

codes_test/vector

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
cue.sh 1.35 KB
一键复制 编辑 原始数据 按行查看 历史
#!/usr/bin/env bash
set -euo pipefail
# cue.sh
#
# SUMMARY
#
# CUE utilities.
ROOT=$(git rev-parse --show-toplevel)
CUE_SOURCES="${ROOT}/website/cue"
list-docs-files() {
find "${CUE_SOURCES}" -name '*.cue'
}
cmd_list() {
list-docs-files
}
cmd_fmt() {
list-docs-files | xargs cue fmt "$@"
}
cmd_vet() {
list-docs-files | xargs cue vet --concrete --all-errors "$@"
}
cmd_eval() {
list-docs-files | xargs cue eval --concrete --all-errors "$@"
}
cmd_export() {
list-docs-files | xargs cue export --all-errors "$@"
}
usage() {
cat >&2 <<-EOF
Usage: $0 MODE
Modes:
list - list all the documentation files
fmt - format all the documentation files
vet - check the documentation files and print errors
eval - print the evaluated documentation,
optionally pass the expression to evaluate via "-e EXPRESSION"
export - export the documentation,
optionally pass the expression to evaluate via "-e EXPRESSION"
Examples:
Print the whole documentation in the JSON format:
$0 export
Print the "components.sources.kubernetes_logs" subtree in CUE format:
$0 eval -e components.sources.kubernetes_logs
Print the "cli" subtree in JSON format:
$0 export -e cli
EOF
exit 1
}
MODE="${1:-}"
case "$MODE" in
list|fmt|vet|eval|export)
shift
"cmd_$MODE" "$@"
;;
*)
usage
;;
esac
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/codes_test/vector.git
git@gitee.com:codes_test/vector.git
codes_test
vector
vector
master

搜索帮助