-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuninstall.sh
More file actions
executable file
·113 lines (99 loc) · 2.49 KB
/
uninstall.sh
File metadata and controls
executable file
·113 lines (99 loc) · 2.49 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/bash
set -e
DOTFILES_DIR="${HOME}/.dotfiles"
# Files to unlink
SYMLINKS=(
"${HOME}/.gitconfig"
"${HOME}/.zshrc"
"${HOME}/.zshenv"
"${HOME}/.zprofile"
"${HOME}/.zlogin"
"${HOME}/.zpreztorc"
"${HOME}/.zprezto/modules/prompt/functions/prompt_svyatov_setup"
"${HOME}/.gemrc"
"${HOME}/.irbrc"
"${HOME}/.railsrc"
"${HOME}/.config/nvim/init.vim"
"${HOME}/.claude/settings.json"
"${HOME}/.claude/statusline-command.sh"
"${HOME}/.claude/CLAUDE.md"
"${HOME}/Library/Application Support/Cursor/User/settings.json"
"${HOME}/Library/Application Support/Cursor/User/keybindings.json"
"${HOME}/.cursor/mcp.json"
"${HOME}/.config/ghostty/config"
)
### Options
###########
DRY_RUN=false
HELP=false
while [[ $# -gt 0 ]]; do
case "$1" in
--dry-run)
DRY_RUN=true
shift
;;
--help|-h)
HELP=true
shift
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
if [[ "$HELP" == true ]]; then
cat << EOF
Usage: uninstall.sh [OPTIONS]
Removes symlinks created by setup.sh and restores backed up files.
Options:
--dry-run Show what would be done without making changes
--help, -h Show this help message
Files that will be unlinked:
EOF
for file in "${SYMLINKS[@]}"; do
echo " $file"
done
exit 0
fi
### Helpers
###########
function remove_symlink() {
local target="$1"
local backup="${target}.orig"
if [[ -L "$target" ]]; then
if [[ "$DRY_RUN" == true ]]; then
echo "[DRY RUN] Would remove symlink: $target"
if [[ -f "$backup" ]]; then
echo "[DRY RUN] Would restore backup: $backup -> $target"
fi
else
rm "$target"
echo "Removed symlink: $target"
if [[ -f "$backup" ]]; then
mv "$backup" "$target"
echo "Restored backup: $target"
fi
fi
elif [[ -e "$target" ]]; then
echo "Skipping (not a symlink): $target"
else
echo "Skipping (does not exist): $target"
fi
}
### Main
########
if [[ "$DRY_RUN" == true ]]; then
echo "=== DRY RUN MODE ==="
echo ""
fi
for file in "${SYMLINKS[@]}"; do
remove_symlink "$file"
done
echo ""
if [[ "$DRY_RUN" == true ]]; then
echo "Dry run complete. No changes were made."
else
echo "Uninstall complete."
echo "Note: Prezto directory (~/.zprezto) was not removed."
fi