-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·56 lines (45 loc) · 1.72 KB
/
install.sh
File metadata and controls
executable file
·56 lines (45 loc) · 1.72 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
#!/usr/bin/env bash
set -e
# Colors for output
GREEN='\033[0;32m'
BLUE='\033[0;34m'
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e "${BLUE}Installing GitGo CLI...${NC}"
# Check for python3
if ! command -v python3 >/dev/null 2>&1; then
echo -e "${RED}Error: python3 is required but not installed. Please install Python 3.8+ first.${NC}"
exit 1
fi
INSTALL_DIR="$HOME/.gitgo"
BIN_DIR="$HOME/.local/bin"
# Remove old installation if exists
if [ -d "$INSTALL_DIR/venv" ]; then
echo "Removing previous installation..."
rm -rf "$INSTALL_DIR/venv"
fi
echo "Creating isolated Python environment in $INSTALL_DIR/venv..."
if ! python3 -m venv "$INSTALL_DIR/venv"; then
echo -e "${RED}Failed to create virtual environment.${NC}"
echo "You may need to install the venv package for your system."
echo "For example, on Ubuntu/Debian: sudo apt install python3-venv"
exit 1
fi
echo "Installing pygitgo from PyPI..."
"$INSTALL_DIR/venv/bin/pip" install --quiet --upgrade pip
"$INSTALL_DIR/venv/bin/pip" install --quiet --upgrade pygitgo
# Create bin directory if it doesn't exist
mkdir -p "$BIN_DIR"
# Link the executable
ln -sf "$INSTALL_DIR/venv/bin/gitgo" "$BIN_DIR/gitgo"
echo -e "\n${GREEN}✅ GitGo installed successfully!${NC}\n"
# Check if ~/.local/bin is in PATH
if [[ ":$PATH:" != *":$BIN_DIR:"* ]]; then
echo -e "⚠️ ${RED}Warning: $BIN_DIR is not in your PATH.${NC}"
echo "To use gitgo from anywhere, add the following to your shell profile (~/.bashrc, ~/.zshrc, etc.):"
echo -e "\n export PATH=\"\$HOME/.local/bin:\$PATH\"\n"
echo "After adding it, restart your terminal or run: source ~/.bashrc"
else
echo -e "You can now run ${BLUE}gitgo${NC} from anywhere."
echo "Try running: gitgo -r"
fi