File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -38,9 +38,31 @@ show_help() {
3838 log_info " --help 显示此帮助信息"
3939}
4040
41+ # 安装 yq 函数
42+ install_yq () {
43+ if ! command -v yq & > /dev/null; then
44+ log_info " 正在安装 yq..."
45+ if wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64; then
46+ chmod +x /usr/local/bin/yq
47+ log_info " yq 安装成功"
48+ else
49+ log_error " yq 下载失败"
50+ return 1
51+ fi
52+ fi
53+ return 0
54+ }
55+
4156# 检查依赖工具是否安装
4257check_dependencies () {
43- local dependencies=(" yq" " jq" )
58+ # 首先安装 yq
59+ install_yq || {
60+ log_error " yq 安装失败"
61+ exit 1
62+ }
63+
64+ # 检查其他依赖
65+ local dependencies=(" jq" )
4466 for dep in " ${dependencies[@]} " ; do
4567 if ! command -v " $dep " & > /dev/null; then
4668 log_info " 正在安装 $dep ..."
You can’t perform that action at this time.
0 commit comments