mirror of
https://github.com/tw93/Mole.git
synced 2026-03-22 21:20:09 +00:00
Add dry-run support across destructive commands (#516)
* chore: update contributors [skip ci] * Add dry-run support across destructive commands Implement dry-run for uninstall, purge, installer, touchid, completion, and remove flows.\nGuard side effects in uninstall path (launchctl, defaults writes, kill/brew actions), update help/README, and add coverage in CLI/Bats tests.\n\nValidation: ./scripts/check.sh and ./scripts/test.sh (452 tests, 0 failures, 8 skipped). * test(purge): keep dev-compatible purge coverage --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Tw93 <hitw93@gmail.com>
This commit is contained in:
@@ -1419,6 +1419,11 @@ force_kill_app() {
|
||||
local app_name="$1"
|
||||
local app_path="${2:-""}"
|
||||
|
||||
if [[ "${MOLE_DRY_RUN:-0}" == "1" ]]; then
|
||||
debug_log "[DRY RUN] Would terminate running app: $app_name"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Get the executable name from bundle if app_path is provided
|
||||
local exec_name=""
|
||||
if [[ -n "$app_path" && -e "$app_path/Contents/Info.plist" ]]; then
|
||||
|
||||
@@ -18,6 +18,7 @@ show_installer_help() {
|
||||
echo "Find and remove installer files (.dmg, .pkg, .iso, .xip, .zip)."
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --dry-run Preview installer cleanup without making changes"
|
||||
echo " --debug Show detailed operation logs"
|
||||
echo " -h, --help Show this help message"
|
||||
}
|
||||
@@ -45,6 +46,7 @@ show_touchid_help() {
|
||||
echo " status Show current Touch ID status"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --dry-run Preview Touch ID changes without modifying sudo config"
|
||||
echo " -h, --help Show this help message"
|
||||
echo ""
|
||||
echo "If no command is provided, an interactive menu is shown."
|
||||
@@ -56,6 +58,7 @@ show_uninstall_help() {
|
||||
echo "Interactively remove applications and their leftover files."
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --dry-run Preview app uninstallation without making changes"
|
||||
echo " --debug Show detailed operation logs"
|
||||
echo " -h, --help Show this help message"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user