-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
executable file
·74 lines (61 loc) · 2.25 KB
/
Copy pathuninstall.sh
File metadata and controls
executable file
·74 lines (61 loc) · 2.25 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
#!/usr/bin/env bash
set -euo pipefail
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BOLD='\033[1m'
NC='\033[0m'
info() { echo -e "${GREEN}✓${NC} $*"; }
warn() { echo -e "${YELLOW}!${NC} $*"; }
skip() { echo -e " (skipped)"; }
ask() {
local prompt="$1"
local reply
read -r -p "$(echo -e "${YELLOW}?${NC} ${prompt} [y/N] ")" reply
[[ "$reply" =~ ^[Yy]$ ]]
}
echo -e "${BOLD}Uninstalling wryayer...${NC}"
echo
# ── Binary ────────────────────────────────────────────────────────────────────
BIN="${HOME}/bin/wryayer"
if [ -f "$BIN" ]; then
rm -f "$BIN"
info "Removed $BIN"
else
warn "$BIN not found, nothing to remove."
fi
# ── Fish completions ──────────────────────────────────────────────────────────
FISH_COMP="${HOME}/.config/fish/completions/wryayer.fish"
if [ -f "$FISH_COMP" ]; then
rm -f "$FISH_COMP"
info "Removed $FISH_COMP"
else
warn "$FISH_COMP not found, nothing to remove."
fi
# ── App data (~/.wryayer/) ─────────────────────────────────────────────────────
WRYAYER_DIR="${HOME}/.wryayer"
if [ -d "$WRYAYER_DIR" ]; then
APP_COUNT=$(find "$WRYAYER_DIR" -maxdepth 1 -mindepth 1 -type d | wc -l)
echo
if ask "Remove $WRYAYER_DIR/ ($APP_COUNT installed app(s)) — this cannot be undone?"; then
rm -rf "$WRYAYER_DIR"
info "Removed $WRYAYER_DIR"
else
skip
warn "Installed apps kept at $WRYAYER_DIR"
fi
fi
# ── Build cache (~/.cache/wryayer/) ───────────────────────────────────────────
CACHE_DIR="${HOME}/.cache/wryayer"
if [ -d "$CACHE_DIR" ]; then
CACHE_SIZE=$(du -sh "$CACHE_DIR" 2>/dev/null | cut -f1)
echo
if ask "Remove $CACHE_DIR/ (build cache, $CACHE_SIZE)?"; then
rm -rf "$CACHE_DIR"
info "Removed $CACHE_DIR"
else
skip
fi
fi
echo
echo -e "${GREEN}${BOLD}Done.${NC}"