-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathuninstall.sh
More file actions
executable file
·107 lines (89 loc) · 2.05 KB
/
Copy pathuninstall.sh
File metadata and controls
executable file
·107 lines (89 loc) · 2.05 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
#!/usr/bin/env bash
#
# GDELT CLI Uninstaller
#
# Removes the gdelt CLI tool from the system.
#
# Usage:
# ./uninstall.sh
#
set -euo pipefail
BINARY_NAME="gdelt"
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m'
info() {
echo -e "${BLUE}[INFO]${NC} $1"
}
success() {
echo -e "${GREEN}[OK]${NC} $1"
}
warn() {
echo -e "${YELLOW}[WARN]${NC} $1"
}
error() {
echo -e "${RED}[ERROR]${NC} $1" >&2
}
# Find and remove binary
remove_binary() {
local locations=(
"${HOME}/.local/bin/${BINARY_NAME}"
"/usr/local/bin/${BINARY_NAME}"
"${HOME}/.cargo/bin/${BINARY_NAME}"
)
local found=false
for loc in "${locations[@]}"; do
if [[ -f "$loc" ]]; then
info "Found binary at: $loc"
read -p "Remove $loc? [y/N] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
rm -f "$loc"
success "Removed $loc"
found=true
fi
fi
done
if [[ "$found" != "true" ]]; then
warn "No gdelt binary found in standard locations"
fi
}
# Remove data directories
remove_data() {
local data_dirs=(
"${HOME}/.local/share/gdelt"
"${HOME}/.cache/gdelt"
"${HOME}/.config/gdelt"
)
for dir in "${data_dirs[@]}"; do
if [[ -d "$dir" ]]; then
info "Found data directory: $dir"
read -p "Remove $dir and all its contents? [y/N] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
rm -rf "$dir"
success "Removed $dir"
fi
fi
done
}
main() {
echo ""
echo "=========================================="
echo " GDELT CLI Uninstaller"
echo "=========================================="
echo ""
remove_binary
echo ""
read -p "Also remove data directories (cache, config, database)? [y/N] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
remove_data
fi
echo ""
success "Uninstall complete"
}
main "$@"