-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathenv.sh
More file actions
40 lines (36 loc) · 1.29 KB
/
env.sh
File metadata and controls
40 lines (36 loc) · 1.29 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
#!/bin/bash
# Source this file to add itsup to your PATH
# Usage: source env.sh
# Get the directory where this script lives
ITSUP_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
# Activate virtual environment
if [ -f "$ITSUP_ROOT/.venv/bin/activate" ]; then
source "$ITSUP_ROOT/.venv/bin/activate"
echo "✓ Activated Python virtual environment"
else
echo "⚠ Virtual environment not found. Run 'make install' first."
return 1
fi
# Add bin to PATH if not already there
if [[ ":$PATH:" != *":$ITSUP_ROOT/bin:"* ]]; then
export PATH="$ITSUP_ROOT/bin:$PATH"
echo "✓ Added itsup to PATH"
echo " You can now run: itsup --help"
else
echo "✓ itsup already in PATH"
fi
# Enable shell completion for itsup
if command -v itsup >/dev/null 2>&1; then
# Detect shell and set up completion
if [ -n "$BASH_VERSION" ]; then
eval "$(_ITSUP_COMPLETE=bash_source itsup)"
echo "✓ Bash completion enabled for itsup"
elif [ -n "$ZSH_VERSION" ]; then
# zsh completion needs compdef; ensure completion system is loaded first
if ! command -v compdef >/dev/null 2>&1; then
autoload -Uz compinit && compinit >/dev/null
fi
eval "$(_ITSUP_COMPLETE=zsh_source itsup)"
echo "✓ Zsh completion enabled for itsup"
fi
fi