环境菜单默认项显示为 dev(默认) 格式,操作菜单移除标签

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Cheng Zhou
2026-06-23 22:22:36 +08:00
parent a81647a4f8
commit 20b414e741
+15 -10
View File
@@ -143,14 +143,10 @@ select_menu() {
local i
for i in "${!options[@]}"; do
local tag="" tag_plain=""
if [[ "$i" -eq "${default_index:-99}" ]]; then
tag=" ${CC_SUCCESS}[自动]${C_RESET}"; tag_plain=" [自动]"
fi
if [[ "$i" -eq "$selected" ]]; then
ctms_box_line "${C_BLUE}${C_BOLD}" "$UI_BOX_WIDTH" "${ICON_BULLET} ${options[$i]}${tag_plain}" "${CC_INFO}${C_BOLD}${ICON_BULLET} ${options[$i]}${C_RESET}${tag}"
ctms_box_line "${C_BLUE}${C_BOLD}" "$UI_BOX_WIDTH" "${ICON_BULLET} ${options[$i]}" "${CC_INFO}${C_BOLD}${ICON_BULLET} ${options[$i]}${C_RESET}"
else
ctms_box_line "${C_BLUE}${C_BOLD}" "$UI_BOX_WIDTH" "${ICON_BULLET_OFF} ${options[$i]}${tag_plain}" "${CC_MUTED}${ICON_BULLET_OFF} ${options[$i]}${C_RESET}${tag}"
ctms_box_line "${C_BLUE}${C_BOLD}" "$UI_BOX_WIDTH" "${ICON_BULLET_OFF} ${options[$i]}" "${CC_MUTED}${ICON_BULLET_OFF} ${options[$i]}${C_RESET}"
fi
done
ctms_box_bottom "${C_BLUE}${C_BOLD}" "$UI_BOX_WIDTH"
@@ -180,10 +176,19 @@ pick_env() {
main) default_index=1 ;;
release) default_index=2 ;;
esac
select_menu "选择环境" "$default_index" \
"dev 本地开发环境 Vite 热加载 / 默认密钥" \
"main 内网测试环境 预发布验证 / 生产模式" \
local -a opts=(
"dev 本地开发环境 Vite 热加载 / 默认密钥"
"main 内网测试环境 预发布验证 / 生产模式"
"release 生产环境 HTTPS / RSA 密钥"
)
if [[ -n "$env" ]]; then
case "$default_index" in
0) opts[0]="dev(默认) 本地开发环境 Vite 热加载 / 默认密钥" ;;
1) opts[1]="main(默认) 内网测试环境 预发布验证 / 生产模式" ;;
2) opts[2]="release(默认) 生产环境 HTTPS / RSA 密钥" ;;
esac
fi
select_menu "选择环境" "$default_index" "${opts[@]}"
case "$SELECTED_INDEX" in
0) SELECTED_ENV="dev" ;;
1) SELECTED_ENV="main" ;;
@@ -228,7 +233,7 @@ pause_return() {
}
interactive_main() {
select_menu "选择操作" "0" \
select_menu "选择操作" "" \
"安装部署 配置环境、构建容器、迁移数据库、健康检查" \
"滚动更新 重建服务、执行迁移、复用安装健康检查" \
"安全卸载 停止并移除容器,保留 .env 与数据文件" \