1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-07 01:55:36 +00:00

style: unify DRY_RUN variable check in trash cleanup

This commit is contained in:
tw93
2026-01-26 10:44:36 +08:00
parent 89eb442866
commit e803c46304

View File

@@ -13,7 +13,7 @@ clean_user_essentials() {
trash_count=$(osascript -e 'tell application "Finder" to count items in trash' 2> /dev/null || echo "0")
[[ "$trash_count" =~ ^[0-9]+$ ]] || trash_count="0"
if [[ "${DRY_RUN:-false}" == "true" ]]; then
if [[ "$DRY_RUN" == "true" ]]; then
[[ $trash_count -gt 0 ]] && echo -e " ${YELLOW}${ICON_DRY_RUN}${NC} Trash · would empty ($trash_count items)" || echo -e " ${GRAY}${ICON_EMPTY}${NC} Trash · already empty"
elif [[ $trash_count -gt 0 ]]; then
if osascript -e 'tell application "Finder" to empty trash' > /dev/null 2>&1; then