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

docs: Improve clarity and conciseness of comments and documentation

This commit is contained in:
Tw93
2025-12-18 17:35:54 +08:00
parent 8eeed7d079
commit 79e40b9c91
14 changed files with 101 additions and 185 deletions

View File

@@ -9,9 +9,7 @@ set -euo pipefail
# Find and remove corrupted .plist files
# ============================================================================
# Clean broken preference files
# Uses plutil -lint to validate plist files
# Returns: count of broken files fixed
# Clean corrupted preference files
fix_broken_preferences() {
local prefs_dir="$HOME/Library/Preferences"
[[ -d "$prefs_dir" ]] || return 0
@@ -68,8 +66,7 @@ fix_broken_preferences() {
# Find and remove login items pointing to non-existent files
# ============================================================================
# Clean broken login items (LaunchAgents pointing to missing executables)
# Returns: count of broken items fixed
# Clean login items with missing executables
fix_broken_login_items() {
local launch_agents_dir="$HOME/Library/LaunchAgents"
[[ -d "$launch_agents_dir" ]] || return 0

View File

@@ -15,7 +15,7 @@ flush_dns_cache() {
sudo dscacheutil -flushcache 2> /dev/null && sudo killall -HUP mDNSResponder 2> /dev/null
}
# System maintenance: rebuild databases and flush caches
# Rebuild databases and flush caches
opt_system_maintenance() {
echo -e "${BLUE}${ICON_ARROW}${NC} Rebuilding LaunchServices database..."
run_with_timeout 10 /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user > /dev/null 2>&1 || true
@@ -39,7 +39,7 @@ opt_system_maintenance() {
}
# Cache refresh: update Finder/Safari caches
# Reset Finder and Safari caches
opt_cache_refresh() {
echo -e "${BLUE}${ICON_ARROW}${NC} Resetting Quick Look cache..."
qlmanage -r cache > /dev/null 2>&1 || true
@@ -61,7 +61,7 @@ opt_cache_refresh() {
echo -e "${GREEN}${ICON_SUCCESS}${NC} Finder and Safari caches updated"
}
# Maintenance scripts: run periodic tasks
# Run periodic maintenance scripts
opt_maintenance_scripts() {
# Run newsyslog to rotate system logs
echo -e "${BLUE}${ICON_ARROW}${NC} Rotating system logs..."
@@ -72,7 +72,7 @@ opt_maintenance_scripts() {
fi
}
# Log cleanup: remove diagnostic and crash logs
# Remove diagnostic and crash logs
opt_log_cleanup() {
echo -e "${BLUE}${ICON_ARROW}${NC} Clearing diagnostic & crash logs..."
local -a user_logs=(
@@ -92,7 +92,7 @@ opt_log_cleanup() {
fi
}
# Recent items: clear recent file lists
# Clear recent file lists
opt_recent_items() {
echo -e "${BLUE}${ICON_ARROW}${NC} Clearing recent items lists..."
local shared_dir="$HOME/Library/Application Support/com.apple.sharedfilelist"