forked from foreveryh/claude-code-switch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
executable file
·40 lines (33 loc) · 1.06 KB
/
uninstall.sh
File metadata and controls
executable file
·40 lines (33 loc) · 1.06 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
#!/usr/bin/env bash
set -euo pipefail
# Uninstaller for Claude Code Model Switcher (CCM)
# - Removes the ccm() and ccc() function blocks from your shell rc files
# - Does NOT remove any binaries or modify PATH
BEGIN_MARK="# >>> ccm function begin >>>"
END_MARK="# <<< ccm function end <<<"
remove_block() {
local rc="$1"
[[ -f "$rc" ]] || return 0
if grep -qF "$BEGIN_MARK" "$rc"; then
local tmp
tmp="$(mktemp)"
awk -v b="$BEGIN_MARK" -v e="$END_MARK" '
$0==b {inblock=1; next}
$0==e {inblock=0; next}
!inblock {print}
' "$rc" > "$tmp" && mv "$tmp" "$rc"
echo "🗑️ Removed ccm and ccc functions from: $rc"
fi
}
main() {
remove_block "$HOME/.zshrc"
remove_block "$HOME/.bashrc"
# Remove installed ccm assets from user data dir
local install_dir="${XDG_DATA_HOME:-$HOME/.local/share}/ccm"
if [[ -d "$install_dir" ]]; then
rm -rf "$install_dir"
echo "🗑️ Removed installed ccm assets at: $install_dir"
fi
echo "✅ Uninstall complete. Reload your shell or run: source ~/.zshrc (or ~/.bashrc)"
}
main "$@"