1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-15 04:40:11 +00:00

Complete automated testing

This commit is contained in:
Tw93
2025-10-12 15:43:45 +08:00
parent f9a93f6052
commit 3c56fe0633
13 changed files with 484 additions and 198 deletions

18
mole
View File

@@ -47,7 +47,8 @@ check_for_updates() {
# Background version check (save to file, don't output)
(
local latest=$(get_latest_version)
local latest
latest=$(get_latest_version)
if [[ -n "$latest" && "$VERSION" != "$latest" && "$(printf '%s\n' "$VERSION" "$latest" | sort -V | head -1)" == "$VERSION" ]]; then
printf "\nUpdate available: %s → %s, run %smo update%s\n\n" "$VERSION" "$latest" "$GREEN" "$NC" > "$msg_cache"
@@ -155,7 +156,8 @@ update_mole() {
fi
# Check for updates
local latest=$(get_latest_version)
local latest
latest=$(get_latest_version)
if [[ -z "$latest" ]]; then
log_error "Unable to check for updates. Check network connection."
@@ -449,9 +451,11 @@ show_main_menu() {
interactive_main_menu() {
# Show intro animation only once per terminal tab
if [[ -t 1 ]]; then
local tty_name=$(tty 2>/dev/null || echo "")
local tty_name
tty_name=$(tty 2>/dev/null || echo "")
if [[ -n "$tty_name" ]]; then
local flag_file="/tmp/mole_intro_$(echo "$tty_name" | tr -c '[:alnum:]_' '_')"
local flag_file
flag_file="/tmp/mole_intro_$(echo "$tty_name" | tr -c '[:alnum:]_' '_')"
if [[ ! -f "$flag_file" ]]; then
animate_mole_intro
touch "$flag_file" 2>/dev/null || true
@@ -489,8 +493,10 @@ interactive_main_menu() {
# Drain any pending input to prevent touchpad scroll issues
drain_pending_input
local key=$(read_key)
[[ $? -ne 0 ]] && continue
local key
if ! key=$(read_key); then
continue
fi
case "$key" in
"UP") ((current_option > 1)) && ((current_option--)) ;;