mirror of
https://github.com/tw93/Mole.git
synced 2026-02-04 11:31:46 +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:
@@ -171,7 +171,7 @@ brew_uninstall_cask() {
|
|||||||
is_homebrew_available || return 1
|
is_homebrew_available || return 1
|
||||||
[[ -z "$cask_name" ]] && 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
|
# Ensure we have sudo access if needed, to prevent brew from hanging on password prompt
|
||||||
if [[ "${NONINTERACTIVE:-}" != "1" && -t 0 && -t 1 ]]; then
|
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
|
# Run with timeout to prevent hangs from problematic cask scripts
|
||||||
local brew_exit=0
|
local brew_exit=0
|
||||||
if HOMEBREW_NO_ENV_HINTS=1 HOMEBREW_NO_AUTO_UPDATE=1 NONINTERACTIVE=1 \
|
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
|
uninstall_ok=true
|
||||||
else
|
else
|
||||||
brew_exit=$?
|
brew_exit=$?
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ total_size_cleaned=0
|
|||||||
# Simulate 'Enter' for confirmation
|
# Simulate 'Enter' for confirmation
|
||||||
printf '\n' | batch_uninstall_applications > /dev/null 2>&1
|
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
|
EOF
|
||||||
|
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
|||||||
Reference in New Issue
Block a user