From 9f42395a3e6c6372f093f4148bbf88d7c9f35afb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=85=8E=E9=A5=BC=E6=9E=9C=E5=AD=90=E5=8D=B7=E9=B2=A8?= =?UTF-8?q?=E9=B1=BC=E8=BE=A3=E6=A4=92?= Date: Mon, 10 Feb 2025 11:22:21 +0800 Subject: [PATCH] refactor: Improve MAC address modification user interaction and error handling - Enhanced MAC address modification prompt with clearer default option - Added robust input handling for MAC address modification choice - Implemented informative logging for MAC address modification outcomes - Simplified user interaction flow with case-based input processing - Removed redundant log message and improved script logic --- scripts/run/cursor_mac_id_modifier.sh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/scripts/run/cursor_mac_id_modifier.sh b/scripts/run/cursor_mac_id_modifier.sh index b112f67..aae7023 100644 --- a/scripts/run/cursor_mac_id_modifier.sh +++ b/scripts/run/cursor_mac_id_modifier.sh @@ -701,16 +701,25 @@ main() { # 添加MAC地址修改选项 echo log_warn "是否要修改MAC地址?" - echo "0) 否 - 保持默认设置 (按回车键)" + echo "0) 否 - 保持默认设置 (默认)" echo "1) 是 - 修改MAC地址" + echo -n "请输入选择 [0-1] (默认 0): " read -r choice - if [ "$choice" = "1" ]; then - modify_mac_address - fi + # 处理用户输入(包括空输入和无效输入) + case "$choice" in + 1) + if modify_mac_address; then + log_info "MAC地址修改完成!" + else + log_error "MAC地址修改失败" + fi + ;; + *) + log_info "已跳过MAC地址修改" + ;; + esac - echo - log_info "MAC地址修改完成!" show_file_tree show_follow_info