mirror of
https://github.com/tw93/Mole.git
synced 2026-03-22 19:40:07 +00:00
chore: auto format code
This commit is contained in:
@@ -878,18 +878,18 @@ validate_terminal_environment() {
|
||||
# Check if TERM is set
|
||||
if [[ -z "${TERM:-}" ]]; then
|
||||
log_warning "TERM environment variable not set"
|
||||
((warnings++))
|
||||
((warnings++)) || true
|
||||
fi
|
||||
|
||||
# Check if running in a known problematic terminal
|
||||
case "${TERM:-}" in
|
||||
dumb)
|
||||
log_warning "Running in 'dumb' terminal, limited functionality"
|
||||
((warnings++))
|
||||
((warnings++)) || true
|
||||
;;
|
||||
unknown)
|
||||
log_warning "Terminal type unknown, may have display issues"
|
||||
((warnings++))
|
||||
((warnings++)) || true
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -898,7 +898,7 @@ validate_terminal_environment() {
|
||||
local cols=$(tput cols 2> /dev/null || echo "80")
|
||||
if [[ "$cols" -lt 60 ]]; then
|
||||
log_warning "Terminal width, $cols cols, is narrow, output may wrap"
|
||||
((warnings++))
|
||||
((warnings++)) || true
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ remove_apps_from_dock() {
|
||||
local url
|
||||
url=$(/usr/libexec/PlistBuddy -c "Print :persistent-apps:$i:tile-data:file-data:_CFURLString" "$plist" 2> /dev/null || echo "")
|
||||
[[ -z "$url" ]] && {
|
||||
((i++))
|
||||
((i++)) || true
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ remove_apps_from_dock() {
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
((i++))
|
||||
((i++)) || true
|
||||
done
|
||||
done
|
||||
|
||||
|
||||
@@ -536,7 +536,7 @@ calculate_total_size() {
|
||||
if [[ -n "$file" && -e "$file" ]]; then
|
||||
local size_kb
|
||||
size_kb=$(get_path_size_kb "$file")
|
||||
((total_kb += size_kb))
|
||||
((total_kb += size_kb)) || true
|
||||
fi
|
||||
done <<< "$files"
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ _request_password() {
|
||||
|
||||
if [[ -z "$password" ]]; then
|
||||
unset password
|
||||
((attempts++))
|
||||
((attempts++)) || true
|
||||
if [[ $attempts -lt 3 ]]; then
|
||||
echo -e "${GRAY}${ICON_WARNING}${NC} Password cannot be empty" > "$tty_path"
|
||||
fi
|
||||
@@ -91,7 +91,7 @@ _request_password() {
|
||||
fi
|
||||
|
||||
unset password
|
||||
((attempts++))
|
||||
((attempts++)) || true
|
||||
if [[ $attempts -lt 3 ]]; then
|
||||
echo -e "${GRAY}${ICON_WARNING}${NC} Incorrect password, try again" > "$tty_path"
|
||||
fi
|
||||
@@ -166,7 +166,7 @@ request_sudo_access() {
|
||||
break
|
||||
fi
|
||||
sleep 0.1
|
||||
((elapsed++))
|
||||
((elapsed++)) || true
|
||||
done
|
||||
|
||||
# Touch ID failed/cancelled - clean up thoroughly before password input
|
||||
@@ -216,7 +216,7 @@ _start_sudo_keepalive() {
|
||||
local retry_count=0
|
||||
while true; do
|
||||
if ! sudo -n -v 2> /dev/null; then
|
||||
((retry_count++))
|
||||
((retry_count++)) || true
|
||||
if [[ $retry_count -ge 3 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -138,8 +138,8 @@ truncate_by_display_width() {
|
||||
fi
|
||||
|
||||
truncated+="$char"
|
||||
((width += char_width))
|
||||
((i++))
|
||||
((width += char_width)) || true
|
||||
((i++)) || true
|
||||
done
|
||||
|
||||
# Restore locale
|
||||
@@ -265,7 +265,7 @@ read_key() {
|
||||
drain_pending_input() {
|
||||
local drained=0
|
||||
while IFS= read -r -s -n 1 -t 0.01 _ 2> /dev/null; do
|
||||
((drained++))
|
||||
((drained++)) || true
|
||||
[[ $drained -gt 100 ]] && break
|
||||
done
|
||||
}
|
||||
@@ -341,7 +341,7 @@ start_inline_spinner() {
|
||||
local c="${chars:$((i % ${#chars})):1}"
|
||||
# Output to stderr to avoid interfering with stdout
|
||||
printf "\r${MOLE_SPINNER_PREFIX:-}${BLUE}%s${NC} %s" "$c" "$display_message" >&2 || break
|
||||
((i++))
|
||||
((i++)) || true
|
||||
sleep 0.05
|
||||
done
|
||||
|
||||
@@ -367,7 +367,7 @@ stop_inline_spinner() {
|
||||
local wait_count=0
|
||||
while kill -0 "$INLINE_SPINNER_PID" 2> /dev/null && [[ $wait_count -lt 5 ]]; do
|
||||
sleep 0.05 2> /dev/null || true
|
||||
((wait_count++))
|
||||
((wait_count++)) || true
|
||||
done
|
||||
|
||||
# Only use SIGKILL as last resort if process is stuck
|
||||
|
||||
Reference in New Issue
Block a user