-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
90 lines (78 loc) · 2.99 KB
/
uninstall.sh
File metadata and controls
90 lines (78 loc) · 2.99 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
#!/bin/bash
#
# mmerd - Simple Uninstallation Script
# Removes mmerd scripts from ~/.local/bin
#
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Installation directory
INSTALL_DIR="$HOME/.local/bin"
echo -e "${BLUE}╔══════════════════════════════════════════╗${NC}"
echo -e "${BLUE}║ mmerd Uninstallation Script ║${NC}"
echo -e "${BLUE}╚══════════════════════════════════════════╝${NC}"
echo
# Show what will be removed
echo -e "${YELLOW}This will remove the following from $INSTALL_DIR:${NC}"
echo " • mmerd - ERD generator from SQL files"
echo " • mmviz - Mermaid to PNG converter"
echo " • mmsvg - Mermaid to SVG converter"
echo " • mmview - Image viewer helper"
echo
read -p "Continue with uninstallation? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo -e "${YELLOW}Uninstallation cancelled.${NC}"
exit 0
fi
# Remove scripts
echo
echo -e "${YELLOW}Removing mmerd scripts...${NC}"
scripts=("mmerd" "mmviz" "mmsvg" "mmview")
removed_count=0
for script in "${scripts[@]}"; do
if [ -f "$INSTALL_DIR/$script" ]; then
rm "$INSTALL_DIR/$script"
echo -e "${GREEN}✓ Removed $script${NC}"
((removed_count++))
else
echo -e "${YELLOW}⚠ $script not found${NC}"
fi
done
# Ask about mermaid-cli
echo
echo -e "${BLUE}Optional: mermaid-cli npm package${NC}"
echo "This is used by mmerd to generate diagrams."
read -p "Also uninstall mermaid-cli? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo -e "${YELLOW}Uninstalling mermaid-cli...${NC}"
if npm uninstall -g @mermaid-js/mermaid-cli 2>/dev/null; then
echo -e "${GREEN}✓ mermaid-cli uninstalled${NC}"
else
echo -e "${YELLOW}Note: You may need sudo to uninstall mermaid-cli:${NC}"
echo " sudo npm uninstall -g @mermaid-js/mermaid-cli"
fi
else
echo -e "${BLUE}ℹ Keeping mermaid-cli${NC}"
fi
# Note about PATH
echo
echo -e "${YELLOW}Note:${NC} The PATH modification in your shell configuration was not removed."
echo " If you want to remove it, edit ~/.bashrc or ~/.zshrc and remove:"
echo " ${BLUE}export PATH=\"\$HOME/.local/bin:\$PATH\"${NC}"
# Summary
echo
if [ $removed_count -gt 0 ]; then
echo -e "${GREEN}╔══════════════════════════════════════════╗${NC}"
echo -e "${GREEN}║ Uninstallation completed successfully! ║${NC}"
echo -e "${GREEN}╚══════════════════════════════════════════╝${NC}"
echo -e "${GREEN}Removed $removed_count script(s) from $INSTALL_DIR${NC}"
else
echo -e "${YELLOW}No scripts were found to remove.${NC}"
fi
echo
echo -e "${BLUE}Thank you for using mmerd!${NC}"