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

feat: Homebrew uninstall with --zap flag (#397)

Uninstalling mole with Zap will automatically remove also the directories that brew creates for it. -> More complete uninstallation

Also updated the test about uninstalling
This commit is contained in:
Andrei Murariu
2026-02-02 05:26:58 +02:00
committed by GitHub
parent 7366047398
commit e8f46a7a1c
2 changed files with 3 additions and 3 deletions

View File

@@ -171,7 +171,7 @@ brew_uninstall_cask() {
is_homebrew_available || return 1
[[ -z "$cask_name" ]] && return 1
debug_log "Attempting brew uninstall --cask $cask_name"
debug_log "Attempting brew uninstall --cask --zap $cask_name"
# Ensure we have sudo access if needed, to prevent brew from hanging on password prompt
if [[ "${NONINTERACTIVE:-}" != "1" && -t 0 && -t 1 ]]; then
@@ -198,7 +198,7 @@ brew_uninstall_cask() {
# Run with timeout to prevent hangs from problematic cask scripts
local brew_exit=0
if HOMEBREW_NO_ENV_HINTS=1 HOMEBREW_NO_AUTO_UPDATE=1 NONINTERACTIVE=1 \
run_with_timeout "$timeout" brew uninstall --cask "$cask_name" 2>&1; then
run_with_timeout "$timeout" brew uninstall --cask --zap "$cask_name" 2>&1; then
uninstall_ok=true
else
brew_exit=$?

View File

@@ -117,7 +117,7 @@ total_size_cleaned=0
# Simulate 'Enter' for confirmation
printf '\n' | batch_uninstall_applications > /dev/null 2>&1
grep -q "uninstall --cask brew-app-cask" "$HOME/brew_calls.log"
grep -q "uninstall --cask --zap brew-app-cask" "$HOME/brew_calls.log"
EOF
[ "$status" -eq 0 ]