1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 18:34:46 +00:00

Automatic formatting

This commit is contained in:
Tw93
2025-10-12 21:43:37 +08:00
parent cf821cdc4b
commit 62537d8d44
8 changed files with 15 additions and 46 deletions

View File

@@ -24,6 +24,7 @@ format_app_display() {
MOLE_SELECTION_RESULT=""
# Main app selection function
# shellcheck disable=SC2154 # apps_data is set by caller
select_apps_for_uninstall() {
if [[ ${#apps_data[@]} -eq 0 ]]; then
log_warning "No applications available for uninstallation"
@@ -33,7 +34,8 @@ select_apps_for_uninstall() {
# Build menu options
local -a menu_options=()
for app_data in "${apps_data[@]}"; do
IFS='|' read -r epoch app_path display_name bundle_id size last_used <<< "$app_data"
# Ignore metadata fields not needed for menu display
IFS='|' read -r _ _ display_name _ size last_used <<< "$app_data"
menu_options+=("$(format_app_display "$display_name" "$size" "$last_used")")
done

View File

@@ -30,7 +30,7 @@ batch_uninstall_applications() {
# Silent analysis without spinner output (avoid visual flicker)
for selected_app in "${selected_apps[@]}"; do
[[ -z "$selected_app" ]] && continue
IFS='|' read -r epoch app_path app_name bundle_id size last_used <<< "$selected_app"
IFS='|' read -r _ app_path app_name bundle_id _ _ <<< "$selected_app"
# Check if app is running (use app path for precise matching)
if pgrep -f "$app_path" > /dev/null 2>&1; then

View File

@@ -122,11 +122,9 @@ icon_menu() {
# Consistent summary blocks for command results
print_summary_block() {
local status="info"
local heading=""
if [[ $# -gt 0 ]]; then
status="$1"
shift
fi
@@ -138,10 +136,6 @@ print_summary_block() {
local -a details=("$@")
local divider="======================================================================"
local color="$BLUE"
local indent=" "
echo "$divider"
if [[ -n "$heading" ]]; then
echo -e "${BLUE}${heading}${NC}"
@@ -253,11 +247,10 @@ read_key() {
# Drain pending input (useful for scrolling prevention)
drain_pending_input() {
local dummy
local drained=0
# Single pass with reasonable timeout
# Touchpad scrolling can generate bursts of arrow keys
while IFS= read -r -s -n 1 -t 0.001 dummy 2> /dev/null; do
while IFS= read -r -s -n 1 -t 0.001 _ 2> /dev/null; do
((drained++))
# Safety limit to prevent infinite loop
[[ $drained -gt 500 ]] && break

View File

@@ -189,7 +189,7 @@ manage_whitelist_categories() {
local -a menu_options=()
local index=0
while IFS='|' read -r display_name pattern category; do
while IFS='|' read -r display_name pattern _; do
# Expand $HOME in pattern
pattern="${pattern/\$HOME/$HOME}"
@@ -240,7 +240,7 @@ manage_whitelist_categories() {
preselected_indices+=("$i")
done
local IFS=','
MOLE_PRESELECTED_INDICES="${preselected_indices[*]}"
export MOLE_PRESELECTED_INDICES="${preselected_indices[*]}"
else
unset MOLE_PRESELECTED_INDICES
fi