-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
executable file
·68 lines (54 loc) · 2.12 KB
/
Copy pathuninstall.sh
File metadata and controls
executable file
·68 lines (54 loc) · 2.12 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bash
# TmuxPlus — Uninstallation script
# Usage: bash uninstall.sh
set -euo pipefail
INSTALL_DIR="$HOME/.TmuxPlus"
CONFIG_DIR="$HOME/.config/tmuxplus"
info() { printf '\033[1;34m::\033[0m %s\n' "$*"; }
ok() { printf '\033[1;32m✔\033[0m %s\n' "$*"; }
warn() { printf '\033[1;33m⚠\033[0m %s\n' "$*"; }
# ── Confirm uninstallation ───────────────────────────
echo ""
info "This script will remove TmuxPlus from your system."
echo ""
read -rp "Do you want to continue? [y/N] " answer
case "$answer" in
[yY]|[yY][eE][sS]) ;;
*) info "Uninstallation cancelled."; exit 0 ;;
esac
# ── Remove shell alias ──────────────────────────────
remove_alias() {
local rc_file="$1"
if [ -f "$rc_file" ] && grep -qF 'tmux-plus' "$rc_file" 2>/dev/null; then
sed -i '/^# TmuxPlus$/d' "$rc_file"
sed -i '/alias tmux-plus=/d' "$rc_file"
ok "Alias removed from $(basename "$rc_file")"
fi
}
[ -f "$HOME/.bashrc" ] && remove_alias "$HOME/.bashrc"
[ -f "$HOME/.zshrc" ] && remove_alias "$HOME/.zshrc"
# ── Remove installation directory ────────────────────
if [ -d "$INSTALL_DIR" ]; then
rm -rf "$INSTALL_DIR"
ok "Directory $INSTALL_DIR removed"
else
warn "Directory $INSTALL_DIR not found (already removed?)"
fi
# ── Remove configuration ────────────────────────────
if [ -d "$CONFIG_DIR" ]; then
read -rp "Remove saved configurations and sessions from $CONFIG_DIR? [y/N] " answer
case "$answer" in
[yY]|[yY][eE][sS])
rm -rf "$CONFIG_DIR"
ok "Configuration removed"
;;
*)
warn "Configuration kept at $CONFIG_DIR"
;;
esac
fi
# ── Done ─────────────────────────────────────────────
echo ""
ok "TmuxPlus uninstalled successfully!"
info "Open a new terminal to apply the shell changes."
echo ""