mirror of
https://github.com/tw93/Mole.git
synced 2026-02-15 10:30:06 +00:00
🐛 mole deletes more thoroughly
This commit is contained in:
7
GUIDE.md
7
GUIDE.md
@@ -219,6 +219,13 @@ mole update
|
||||
brew upgrade mole
|
||||
```
|
||||
|
||||
**💡 提示:** 如果 `brew upgrade mole` 显示已是最新版本,但实际上有新版本发布:
|
||||
|
||||
```bash
|
||||
brew update # 先刷新 Homebrew tap 信息
|
||||
brew upgrade mole # 再执行升级
|
||||
```
|
||||
|
||||
### 如何卸载 Mole?
|
||||
|
||||
如果你想要卸载 Mole(不管是一键安装还是 Homebrew 安装):
|
||||
|
||||
@@ -52,7 +52,9 @@ mole remove # Remove Mole from system
|
||||
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
|
||||
|
||||
|
||||
56
mole
56
mole
@@ -22,7 +22,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/lib/common.sh"
|
||||
|
||||
# Version info
|
||||
VERSION="1.5.3"
|
||||
VERSION="1.5.4"
|
||||
MOLE_TAGLINE="can dig deep to clean your Mac."
|
||||
|
||||
# Check for updates (non-blocking, cached)
|
||||
@@ -242,14 +242,16 @@ remove_mole() {
|
||||
echo -e " ${GREEN}✓${NC} Mole (via Homebrew)"
|
||||
fi
|
||||
|
||||
for install in "${manual_installs[@]}"; do
|
||||
echo -e " ${GREEN}✓${NC} $install"
|
||||
local install_dir="$(dirname "$install")"
|
||||
local install_root="$(dirname "$install_dir")"
|
||||
if [[ -d "$install_root/lib" ]]; then
|
||||
echo -e " ${GREEN}✓${NC} $install_root/lib/"
|
||||
fi
|
||||
done
|
||||
if [[ ${#manual_installs[@]} -gt 0 ]]; then
|
||||
for install in "${manual_installs[@]}"; do
|
||||
echo -e " ${GREEN}✓${NC} $install"
|
||||
local install_dir="$(dirname "$install")"
|
||||
local install_root="$(dirname "$install_dir")"
|
||||
if [[ -d "$install_root/lib" ]]; then
|
||||
echo -e " ${GREEN}✓${NC} $install_root/lib/"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
echo -e " ${GREEN}✓${NC} ~/.config/mole/ (configuration)"
|
||||
echo -e " ${GREEN}✓${NC} ~/.cache/mole/ (cache)"
|
||||
@@ -285,26 +287,28 @@ remove_mole() {
|
||||
fi
|
||||
|
||||
# Remove manual installations
|
||||
for install in "${manual_installs[@]}"; do
|
||||
if [[ -f "$install" ]]; then
|
||||
if rm -f "$install" 2>/dev/null; then
|
||||
log_success "Removed: $install"
|
||||
else
|
||||
log_error "Failed to remove $install (try with sudo)"
|
||||
if [[ ${#manual_installs[@]} -gt 0 ]]; then
|
||||
for install in "${manual_installs[@]}"; do
|
||||
if [[ -f "$install" ]]; then
|
||||
if rm -f "$install" 2>/dev/null; then
|
||||
log_success "Removed: $install"
|
||||
else
|
||||
log_error "Failed to remove $install (try with sudo)"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Remove lib directory if it exists
|
||||
local install_dir="$(dirname "$install")"
|
||||
local install_root="$(dirname "$install_dir")"
|
||||
if [[ -d "$install_root/lib" ]]; then
|
||||
if rm -rf "$install_root/lib" 2>/dev/null; then
|
||||
log_success "Removed library files from $install_root"
|
||||
else
|
||||
log_warning "Could not remove $install_root/lib (may need sudo)"
|
||||
# Remove lib directory if it exists
|
||||
local install_dir="$(dirname "$install")"
|
||||
local install_root="$(dirname "$install_dir")"
|
||||
if [[ -d "$install_root/lib" ]]; then
|
||||
if rm -rf "$install_root/lib" 2>/dev/null; then
|
||||
log_success "Removed library files from $install_root"
|
||||
else
|
||||
log_warning "Could not remove $install_root/lib (may need sudo)"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
# Clean up configuration and cache (both methods)
|
||||
if [[ -d "$HOME/.config/mole" ]]; then
|
||||
|
||||
Reference in New Issue
Block a user