-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathinstall.sh
More file actions
109 lines (91 loc) · 2.92 KB
/
install.sh
File metadata and controls
109 lines (91 loc) · 2.92 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
104
105
106
107
108
109
#!/bin/bash
# GudaCC Commands Installer
# https://github.com/GuDaStudio/commands
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
COMMAND_NAME="gudaspec"
usage() {
echo -e "${BLUE}GudaCC Commands Installer${NC}"
echo ""
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Options:"
echo " -u, --user Install to user-level (~/.claude/commands/)"
echo " -p, --project Install to project-level (./.claude/commands/)"
echo " -t, --target <path> Install to custom target path"
echo " -h, --help Show this help message"
echo ""
echo "Examples:"
echo " $0 --user"
echo " $0 --project"
echo " $0 --target /custom/path"
}
install_command() {
local target_dir=$1
local source_dir="$SCRIPT_DIR/$COMMAND_NAME"
local dest_dir="$target_dir/$COMMAND_NAME"
if [ ! -d "$source_dir" ]; then
echo -e "${RED}Error: '$COMMAND_NAME' not found in source directory${NC}"
return 1
fi
echo -e "${BLUE}Installing${NC} $COMMAND_NAME -> $dest_dir"
mkdir -p "$target_dir"
if [ -d "$dest_dir" ]; then
echo -e "${YELLOW} Removing existing installation...${NC}"
rm -rf "$dest_dir"
fi
cp -r "$source_dir" "$dest_dir"
if [ -f "$dest_dir/.git" ]; then
rm "$dest_dir/.git"
fi
echo -e "${GREEN} ✓ Installed${NC}"
}
TARGET_PATH=""
while [[ $# -gt 0 ]]; do
case $1 in
-u|--user)
TARGET_PATH="$HOME/.claude/commands"
shift
;;
-p|--project)
TARGET_PATH="./.claude/commands"
shift
;;
-t|--target)
TARGET_PATH="$2"
shift 2
;;
-h|--help)
usage
exit 0
;;
*)
echo -e "${RED}Unknown option: $1${NC}"
usage
exit 1
;;
esac
done
if [ -z "$TARGET_PATH" ]; then
echo -e "${RED}Error: Please specify installation target (-u, -p, or -t)${NC}"
echo ""
usage
exit 1
fi
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE}GudaCC Commands Installer${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
echo -e "Target: ${GREEN}$TARGET_PATH${NC}"
echo -e "Command: ${GREEN}$COMMAND_NAME${NC}"
echo ""
install_command "$TARGET_PATH"
echo ""
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${GREEN}Installation complete!${NC}"
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"