-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
51 lines (41 loc) · 1.51 KB
/
Copy pathuninstall.sh
File metadata and controls
51 lines (41 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
# Uninstallation script for mkfile
set -e
INSTALL_DIR="$HOME/.local/bin"
COMPLETION_DIR="$HOME/.local/share/bash-completion/completions"
echo "🗑️ Uninstalling mkfile..."
# Remove the executable
if [[ -f "$INSTALL_DIR/mkfile" ]]; then
rm "$INSTALL_DIR/mkfile"
echo "✓ Removed mkfile from $INSTALL_DIR"
else
echo "⚠️ mkfile not found in $INSTALL_DIR"
fi
# Remove bash completion
if [[ -f "$COMPLETION_DIR/mkfile" ]]; then
rm "$COMPLETION_DIR/mkfile"
echo "✓ Removed bash completion"
fi
# Clean up shell configs
for rc in "$HOME/.bashrc" "$HOME/.zshrc"; do
if [[ -f "$rc" ]]; then
# Check if any mkfile config exists
if grep -q "# mkfile" "$rc" 2>/dev/null; then
# Create backup
cp "$rc" "$rc.backup.$(date +%Y%m%d_%H%M%S)"
# Remove mkfile-specific lines with precise patterns
if sed --version &>/dev/null 2>&1; then
# GNU sed (Linux)
sed -i '/# mkfile CLI/d; /# mkfile bash completion/d; /\.local\/bin\/mkfile/d; /bash-completion\/completions\/mkfile/d' "$rc"
else
# BSD sed (macOS)
sed -i '' '/# mkfile CLI/d; /# mkfile bash completion/d; /\.local\/bin\/mkfile/d; /bash-completion\/completions\/mkfile/d' "$rc"
fi
echo "✓ Cleaned up $rc (backup created)"
fi
fi
done
echo ""
echo "✅ Uninstallation complete!"
echo ""
echo "Please restart your terminal or run: source ~/.bashrc"