mirror of
https://github.com/tw93/Mole.git
synced 2026-02-12 22:10:14 +00:00
chore: auto format code
This commit is contained in:
@@ -40,7 +40,7 @@ clean_homebrew() {
|
|||||||
local skip_cleanup=false
|
local skip_cleanup=false
|
||||||
local brew_cache_size=0
|
local brew_cache_size=0
|
||||||
if [[ -d ~/Library/Caches/Homebrew ]]; then
|
if [[ -d ~/Library/Caches/Homebrew ]]; then
|
||||||
brew_cache_size=$(run_with_timeout 3 du -sk ~/Library/Caches/Homebrew 2>/dev/null | awk '{print $1}')
|
brew_cache_size=$(run_with_timeout 3 du -sk ~/Library/Caches/Homebrew 2> /dev/null | awk '{print $1}')
|
||||||
local du_exit=$?
|
local du_exit=$?
|
||||||
|
|
||||||
# Skip cleanup (but still run autoremove) if cache is small
|
# Skip cleanup (but still run autoremove) if cache is small
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ scan_external_volumes() {
|
|||||||
# Use diskutil to intelligently detect network volumes (SMB/NFS/AFP)
|
# Use diskutil to intelligently detect network volumes (SMB/NFS/AFP)
|
||||||
# Timeout protection: 1s per volume to avoid slow network responses
|
# Timeout protection: 1s per volume to avoid slow network responses
|
||||||
local protocol=""
|
local protocol=""
|
||||||
protocol=$(run_with_timeout 1 command diskutil info "$volume" 2>/dev/null | grep -i "Protocol:" | awk '{print $2}' || echo "")
|
protocol=$(run_with_timeout 1 command diskutil info "$volume" 2> /dev/null | grep -i "Protocol:" | awk '{print $2}' || echo "")
|
||||||
|
|
||||||
case "$protocol" in
|
case "$protocol" in
|
||||||
SMB | NFS | AFP | CIFS | WebDAV)
|
SMB | NFS | AFP | CIFS | WebDAV)
|
||||||
@@ -38,7 +38,7 @@ scan_external_volumes() {
|
|||||||
|
|
||||||
# Fallback: Check filesystem type via df if diskutil didn't identify protocol
|
# Fallback: Check filesystem type via df if diskutil didn't identify protocol
|
||||||
local fs_type=""
|
local fs_type=""
|
||||||
fs_type=$(run_with_timeout 1 command df -T "$volume" 2>/dev/null | tail -1 | awk '{print $2}' || echo "")
|
fs_type=$(run_with_timeout 1 command df -T "$volume" 2> /dev/null | tail -1 | awk '{print $2}' || echo "")
|
||||||
case "$fs_type" in
|
case "$fs_type" in
|
||||||
nfs | smbfs | afpfs | cifs | webdav)
|
nfs | smbfs | afpfs | cifs | webdav)
|
||||||
network_volumes+=("$volume")
|
network_volumes+=("$volume")
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ paginated_multi_select() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local -a selected=()
|
local -a selected=()
|
||||||
local selected_count=0 # Cache selection count to avoid O(n) loops on every draw
|
local selected_count=0 # Cache selection count to avoid O(n) loops on every draw
|
||||||
|
|
||||||
# Initialize selection array
|
# Initialize selection array
|
||||||
for ((i = 0; i < total_items; i++)); do
|
for ((i = 0; i < total_items; i++)); do
|
||||||
@@ -655,12 +655,12 @@ paginated_multi_select() {
|
|||||||
|
|
||||||
# Drain pending input for smoother fast scrolling
|
# Drain pending input for smoother fast scrolling
|
||||||
drain_pending_input
|
drain_pending_input
|
||||||
continue # Skip full redraw
|
continue # Skip full redraw
|
||||||
elif [[ $top_index -gt 0 ]]; then
|
elif [[ $top_index -gt 0 ]]; then
|
||||||
((top_index--))
|
((top_index--))
|
||||||
prev_cursor_pos=$cursor_pos
|
prev_cursor_pos=$cursor_pos
|
||||||
prev_top_index=$top_index
|
prev_top_index=$top_index
|
||||||
need_full_redraw=true # Scrolling requires full redraw
|
need_full_redraw=true # Scrolling requires full redraw
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
"DOWN")
|
"DOWN")
|
||||||
@@ -696,7 +696,7 @@ paginated_multi_select() {
|
|||||||
|
|
||||||
# Drain pending input for smoother fast scrolling
|
# Drain pending input for smoother fast scrolling
|
||||||
drain_pending_input
|
drain_pending_input
|
||||||
continue # Skip full redraw
|
continue # Skip full redraw
|
||||||
elif [[ $((top_index + visible_count)) -lt ${#view_indices[@]} ]]; then
|
elif [[ $((top_index + visible_count)) -lt ${#view_indices[@]} ]]; then
|
||||||
((top_index++))
|
((top_index++))
|
||||||
visible_count=$((${#view_indices[@]} - top_index))
|
visible_count=$((${#view_indices[@]} - top_index))
|
||||||
@@ -706,7 +706,7 @@ paginated_multi_select() {
|
|||||||
fi
|
fi
|
||||||
prev_cursor_pos=$cursor_pos
|
prev_cursor_pos=$cursor_pos
|
||||||
prev_top_index=$top_index
|
prev_top_index=$top_index
|
||||||
need_full_redraw=true # Scrolling requires full redraw
|
need_full_redraw=true # Scrolling requires full redraw
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -735,7 +735,7 @@ paginated_multi_select() {
|
|||||||
# Move cursor to footer to avoid visual artifacts (items + header + 2 blanks)
|
# Move cursor to footer to avoid visual artifacts (items + header + 2 blanks)
|
||||||
printf "\033[%d;1H" "$((items_per_page + 4))" >&2
|
printf "\033[%d;1H" "$((items_per_page + 4))" >&2
|
||||||
|
|
||||||
continue # Skip full redraw
|
continue # Skip full redraw
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
"RETRY")
|
"RETRY")
|
||||||
|
|||||||
Reference in New Issue
Block a user