-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-jdcode.sh
More file actions
executable file
·48 lines (42 loc) · 1.52 KB
/
install-jdcode.sh
File metadata and controls
executable file
·48 lines (42 loc) · 1.52 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
#!/bin/bash
set -e
echo "Installing jdcode CLI tool..."
# Copy the jdcode script to a directory in PATH if possible
if command -v which >/dev/null 2>&1; then
# Check user's preferred locations first
if [ -d "$HOME/bin" ] && [ -w "$HOME/bin" ]; then
TARGET_DIR="$HOME/bin"
elif [ -d "$HOME/.local/bin" ] && [ -w "$HOME/.local/bin" ]; then
TARGET_DIR="$HOME/.local/bin"
elif [ -w "/usr/local/bin" ]; then
TARGET_DIR="/usr/local/bin"
else
# Try to find a suitable location in PATH
TARGET_DIR=""
for dir in $(echo $PATH | tr ':' ' '); do
if [ -w "$dir" ] && [ -d "$dir" ]; then
TARGET_DIR="$dir"
break
fi
done
fi
if [ -n "$TARGET_DIR" ]; then
cp ./jdcode "$TARGET_DIR/jdcode"
chmod +x "$TARGET_DIR/jdcode"
echo "jdcode installed to $TARGET_DIR/jdcode"
echo "You can now use: jdcode python or jdcode ts"
else
echo "Warning: No writable directory in PATH found"
echo "Please copy the jdcode script to a directory in your PATH"
echo "Or run: cp /code/jdcode ~/bin/jdcode && chmod +x ~/bin/jdcode"
fi
else
echo "Warning: which command not found, installation may be limited"
fi
echo ""
echo "Installation complete!"
echo "Usage examples:"
echo " jdcode python # Run Python variant"
echo " jdcode ts # Run TypeScript variant"
echo " jdcode python --port 9000 # Run with custom port"
echo " jdcode --help # Show help"