-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·103 lines (84 loc) · 2.49 KB
/
install.sh
File metadata and controls
executable file
·103 lines (84 loc) · 2.49 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
#!/bin/bash
# One-line Dotfiles Setup Script
# Purpose: Clone and setup dotfiles on a new machine
#
# Usage:
# ./install.sh [DOTFILES_DIR]
# ./install.sh # Prompts for directory (default: ~/.dotfiles)
# ./install.sh ~/my-dotfiles # Uses specified directory
set -e
# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
NC='\033[0m'
print_status() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
# Get dotfiles directory
get_dotfiles_dir() {
local default_dir="$HOME/.dotfiles"
if [ -n "$1" ]; then
# Use provided directory
echo "$1"
elif [ -n "$DOTFILES_DIR" ]; then
# Use environment variable if set
echo "$DOTFILES_DIR"
else
# Prompt user for directory
echo -n "Enter dotfiles directory [default: $default_dir]: "
read -r user_dir
if [ -z "$user_dir" ]; then
echo "$default_dir"
else
echo "$user_dir"
fi
fi
}
# Save DOTFILES_DIR to environment file
save_dotfiles_env() {
local dotfiles_dir="$1"
local env_file="$HOME/.dotfiles-env"
cat > "$env_file" << EOF
# Dotfiles directory location
# This file is automatically generated by install.sh
export DOTFILES_DIR="$dotfiles_dir"
EOF
print_success "Saved DOTFILES_DIR to $env_file"
}
# Main setup
main() {
print_status "Setting up AI development environment..."
# Get dotfiles directory
DOTFILES_DIR=$(get_dotfiles_dir "$1")
DOTFILES_DIR=$(eval echo "$DOTFILES_DIR") # Expand ~ and variables
print_status "Using dotfiles directory: $DOTFILES_DIR"
# Save to environment file
save_dotfiles_env "$DOTFILES_DIR"
# Clone dotfiles if not present
if [ ! -d "$DOTFILES_DIR" ]; then
print_status "Cloning dotfiles repository..."
git clone https://github.com/Lutherwaves/dotfiles.git "$DOTFILES_DIR"
else
print_status "Dotfiles already exist, updating..."
cd "$DOTFILES_DIR"
git pull
fi
# Run setup script with DOTFILES_DIR
print_status "Running setup script..."
cd "$DOTFILES_DIR"
DOTFILES_DIR="$DOTFILES_DIR" ./scripts/setup.sh
print_success "Setup complete! 🎉"
echo ""
print_status "Next steps:"
echo "1. Reload your shell: source ~/.zshrc"
echo "2. Configure API keys in ~/.ai-env"
echo "3. Start developing: dev-ai claude"
}
main "$@"