1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-11 23:29:01 +00:00

🐛 mole deletes more thoroughly

This commit is contained in:
Tw93
2025-10-05 17:07:15 +08:00
parent 032edce5be
commit 47b3519fc7
3 changed files with 40 additions and 27 deletions

View File

@@ -219,6 +219,13 @@ mole update
brew upgrade mole brew upgrade mole
``` ```
**💡 提示:** 如果 `brew upgrade mole` 显示已是最新版本,但实际上有新版本发布:
```bash
brew update # 先刷新 Homebrew tap 信息
brew upgrade mole # 再执行升级
```
### 如何卸载 Mole ### 如何卸载 Mole
如果你想要卸载 Mole不管是一键安装还是 Homebrew 安装): 如果你想要卸载 Mole不管是一键安装还是 Homebrew 安装):

View File

@@ -52,7 +52,9 @@ mole remove # Remove Mole from system
mole --help # Show help mole --help # Show help
``` ```
> 💡 New to terminal? Check [小白使用指南](./GUIDE.md) · Homebrew users: `brew upgrade mole` to update > 💡 New to terminal? Check [小白使用指南](./GUIDE.md)
>
> 💡 **Homebrew users:** If `brew upgrade mole` shows no updates, run `brew update` first to refresh the tap, then `brew upgrade mole`
> >
> 💡 **Tip:** Run `mole clean --dry-run` to preview, or `mole clean --whitelist` to protect important caches before cleanup > 💡 **Tip:** Run `mole clean --dry-run` to preview, or `mole clean --whitelist` to protect important caches before cleanup

56
mole
View File

@@ -22,7 +22,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/lib/common.sh" source "$SCRIPT_DIR/lib/common.sh"
# Version info # Version info
VERSION="1.5.3" VERSION="1.5.4"
MOLE_TAGLINE="can dig deep to clean your Mac." MOLE_TAGLINE="can dig deep to clean your Mac."
# Check for updates (non-blocking, cached) # Check for updates (non-blocking, cached)
@@ -242,14 +242,16 @@ remove_mole() {
echo -e " ${GREEN}✓${NC} Mole (via Homebrew)" echo -e " ${GREEN}✓${NC} Mole (via Homebrew)"
fi fi
for install in "${manual_installs[@]}"; do if [[ ${#manual_installs[@]} -gt 0 ]]; then
echo -e " ${GREEN}✓${NC} $install" for install in "${manual_installs[@]}"; do
local install_dir="$(dirname "$install")" echo -e " ${GREEN}✓${NC} $install"
local install_root="$(dirname "$install_dir")" local install_dir="$(dirname "$install")"
if [[ -d "$install_root/lib" ]]; then local install_root="$(dirname "$install_dir")"
echo -e " ${GREEN}✓${NC} $install_root/lib/" if [[ -d "$install_root/lib" ]]; then
fi echo -e " ${GREEN}✓${NC} $install_root/lib/"
done fi
done
fi
echo -e " ${GREEN}✓${NC} ~/.config/mole/ (configuration)" echo -e " ${GREEN}✓${NC} ~/.config/mole/ (configuration)"
echo -e " ${GREEN}✓${NC} ~/.cache/mole/ (cache)" echo -e " ${GREEN}✓${NC} ~/.cache/mole/ (cache)"
@@ -285,26 +287,28 @@ remove_mole() {
fi fi
# Remove manual installations # Remove manual installations
for install in "${manual_installs[@]}"; do if [[ ${#manual_installs[@]} -gt 0 ]]; then
if [[ -f "$install" ]]; then for install in "${manual_installs[@]}"; do
if rm -f "$install" 2>/dev/null; then if [[ -f "$install" ]]; then
log_success "Removed: $install" if rm -f "$install" 2>/dev/null; then
else log_success "Removed: $install"
log_error "Failed to remove $install (try with sudo)" else
log_error "Failed to remove $install (try with sudo)"
fi
fi fi
fi
# Remove lib directory if it exists # Remove lib directory if it exists
local install_dir="$(dirname "$install")" local install_dir="$(dirname "$install")"
local install_root="$(dirname "$install_dir")" local install_root="$(dirname "$install_dir")"
if [[ -d "$install_root/lib" ]]; then if [[ -d "$install_root/lib" ]]; then
if rm -rf "$install_root/lib" 2>/dev/null; then if rm -rf "$install_root/lib" 2>/dev/null; then
log_success "Removed library files from $install_root" log_success "Removed library files from $install_root"
else else
log_warning "Could not remove $install_root/lib (may need sudo)" log_warning "Could not remove $install_root/lib (may need sudo)"
fi
fi fi
fi done
done fi
# Clean up configuration and cache (both methods) # Clean up configuration and cache (both methods)
if [[ -d "$HOME/.config/mole" ]]; then if [[ -d "$HOME/.config/mole" ]]; then