-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
executable file
·44 lines (36 loc) · 1.08 KB
/
Copy pathuninstall.sh
File metadata and controls
executable file
·44 lines (36 loc) · 1.08 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
#!/usr/bin/env bash
set -euo pipefail
# bb CLI uninstaller — removes the source line from shell RC
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BB_SCRIPT="$SCRIPT_DIR/bb.sh"
detect_rc() {
local shell_name
shell_name=$(basename "$SHELL")
case "$shell_name" in
zsh) echo "$HOME/.zshrc" ;;
bash) echo "$HOME/.bashrc" ;;
*) echo "$HOME/.${shell_name}rc" ;;
esac
}
RC_FILE=$(detect_rc)
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m'
echo ""
echo " bb CLI — Uninstaller"
echo ""
if grep -qF "$BB_SCRIPT" "$RC_FILE" 2>/dev/null; then
# Remove the line containing our script path
grep -vF "$BB_SCRIPT" "$RC_FILE" > "${RC_FILE}.tmp"
mv "${RC_FILE}.tmp" "$RC_FILE"
echo -e " ${GREEN}Removed source line from $RC_FILE${NC}"
else
echo -e " ${YELLOW}No source line found in $RC_FILE — nothing to remove.${NC}"
fi
echo ""
echo " Note: Credentials at ~/.config/bb/credentials were NOT removed."
echo " Delete them manually if you want a full cleanup:"
echo " rm -rf ~/.config/bb"
echo ""
echo " Reload your shell or run: source $RC_FILE"
echo ""