-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
executable file
·59 lines (50 loc) · 1.78 KB
/
Copy pathuninstall.sh
File metadata and controls
executable file
·59 lines (50 loc) · 1.78 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
#!/bin/zsh
# ==============================================================================
# uninstall.sh — remove mkproject from a local prefix (default: ~/.local)
# COPYRIGHT: (C) 2026 Daniel Duvernais
# SPDX-License-Identifier: GPL-3.0-or-later
# ==============================================================================
set -euo pipefail
yes=0
while (( $# > 0 )); do
case "$1" in
-y|--yes) yes=1; shift ;;
-h|--help)
cat <<'HELP'
Usage: uninstall.sh [-y]
Removes the mkproject install tree and man-page symlink.
Does not delete ~/.config/mkproject/ (your personal config).
After running, remove from ~/.zshrc:
source ~/.config/mkproject/shell.zsh # if present
HELP
exit 0
;;
*) print -u2 -- "Unknown option: $1"; exit 1 ;;
esac
done
SCRIPT_DIR="${0:A:h}"
PREFIX="${PREFIX:-$HOME/.local}"
DEST="${DEST:-$PREFIX/bin/mkproject}"
MAN_LINK="$PREFIX/share/man/man1/mkproject.1"
SNIPPET="${XDG_CONFIG_HOME:-$HOME/.config}/mkproject/shell.zsh"
print -- "Will remove:"
print -- " $DEST"
[[ -e "$MAN_LINK" || -L "$MAN_LINK" ]] && print -- " $MAN_LINK"
print -- ""
print -- "Will keep:"
print -- " ${XDG_CONFIG_HOME:-$HOME/.config}/mkproject/ (config + passport)"
print -- ""
if (( ! yes )); then
print -n -- "Continue? [y/N] "
read -r reply
[[ "$reply" == [yY] ]] || { print -- "Aborted."; exit 0; }
fi
[[ -d "$DEST" ]] && rm -rf "$DEST" && print -- "✓ Removed $DEST"
[[ -e "$MAN_LINK" || -L "$MAN_LINK" ]] && rm -f "$MAN_LINK" && print -- "✓ Removed $MAN_LINK"
print -- ""
print -- "Manual cleanup (if you added these to ~/.zshrc):"
print -- " source $SNIPPET"
print -- " fpath=(~/.local/bin/mkproject \$fpath)"
print -- " alias mkproject=\"source ~/.local/bin/mkproject/mkproject.sh\""
print -- ""
print -- "Done."