1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-22 17:55:08 +00:00

fix: gate main menu update action on update availability

Follow-up to #540.
This commit is contained in:
Tw93
2026-03-06 07:18:05 +08:00
parent 603df79a01
commit 423c424f52
2 changed files with 77 additions and 5 deletions

14
mole
View File

@@ -737,11 +737,11 @@ show_main_menu() {
if [[ -t 0 ]]; then
printf '\r\033[2K\n'
local controls="${GRAY}↑↓ | Enter | M More | "
local controls="${GRAY}↑↓ | Enter | M More"
if ! is_touchid_configured; then
controls="${controls}T TouchID"
else
controls="${controls}U Update"
controls="${controls} | T TouchID"
elif [[ "${MAIN_MENU_SHOW_UPDATE:-false}" == "true" ]]; then
controls="${controls} | U Update"
fi
controls="${controls} | Q Quit${NC}"
printf '\r\033[2K%s\n' "$controls"
@@ -765,6 +765,7 @@ interactive_main_menu() {
update_message="$(cat "$msg_cache" 2> /dev/null || echo "")"
fi
MAIN_MENU_UPDATE_MESSAGE="$update_message"
MAIN_MENU_SHOW_UPDATE="$([[ -n "$update_message" ]] && echo true || echo false)"
cleanup_and_exit() {
show_cursor
@@ -835,6 +836,7 @@ interactive_main_menu() {
exec "$SCRIPT_DIR/bin/touchid.sh"
;;
"UPDATE")
[[ "${MAIN_MENU_SHOW_UPDATE:-false}" == "true" ]] || continue
show_cursor
clear
update_mole
@@ -940,6 +942,8 @@ main() {
esac
}
if [[ "${MOLE_SKIP_MAIN:-0}" != "1" ]]; then
if [[ "${MOLE_TEST_MODE:-0}" == "1" && "${MOLE_SKIP_MAIN:-0}" == "1" ]]; then
:
else
main "$@"
fi