-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
executable file
·82 lines (69 loc) · 1.68 KB
/
Copy pathuninstall.sh
File metadata and controls
executable file
·82 lines (69 loc) · 1.68 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
#!/bin/bash
# Colors for messages
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
NC='\033[0m'
echo -e "${BLUE}Starting Jarvis uninstallation...${NC}"
# Deactivate virtual environment if it's active
if [[ -n "$VIRTUAL_ENV" ]]; then
deactivate
echo -e "${GREEN}Deactivated virtual environment${NC}"
fi
# Remove virtual environment
if [ -d "venv" ]; then
rm -rf "venv"
echo -e "${GREEN}Removed virtual environment${NC}"
fi
# Remove project directories
directories=(
"config"
"jarvis"
"data"
"tests"
"scripts"
"__pycache__"
".pytest_cache"
"build"
"dist"
)
for dir in "${directories[@]}"; do
if [ -d "$dir" ]; then
rm -rf "$dir"
echo -e "${GREEN}Removed $dir${NC}"
fi
done
# Remove project files
files=(
".env"
"requirements.txt"
"setup.py"
".gitignore"
)
for file in "${files[@]}"; do
if [ -f "$file" ]; then
rm -f "$file"
echo -e "${GREEN}Removed $file${NC}"
fi
done
# Remove Python cache files
find . -type f -name "*.pyc" -delete
find . -type f -name "*.log" -delete
find . -type d -name "*.egg-info" -exec rm -rf {} +
echo -e "${GREEN}Removed Python cache and log files${NC}"
# Remove git repository if it exists
if [ -d ".git" ]; then
rm -rf ".git"
echo -e "${GREEN}Removed Git repository${NC}"
fi
echo -e "${GREEN}Uninstallation complete!${NC}"
# Offer to remove the current directory
read -p "Do you want to remove the current directory? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
parent_dir="$(dirname "$(pwd)")"
project_dir="$(basename "$(pwd)")"
cd "$parent_dir" || exit
rm -rf "$project_dir"
echo -e "${GREEN}Removed project directory${NC}"
fi