mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-11 03:13:12 +00:00
- Core ccs bash script with profile switching - Installation script with PATH verification - Example config template - Comprehensive README with troubleshooting - Security: input validation, injection prevention - MIT license
45 lines
1.1 KiB
Bash
Executable File
45 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
INSTALL_DIR="${INSTALL_DIR:-$HOME/.local/bin}"
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
echo "Installing ccs to $INSTALL_DIR..."
|
|
echo ""
|
|
|
|
# Create install dir if needed
|
|
mkdir -p "$INSTALL_DIR"
|
|
|
|
# Make executable first
|
|
chmod +x "$SCRIPT_DIR/ccs"
|
|
|
|
# Symlink ccs script
|
|
ln -sf "$SCRIPT_DIR/ccs" "$INSTALL_DIR/ccs"
|
|
|
|
# Verify installation
|
|
if [[ ! -L "$INSTALL_DIR/ccs" ]]; then
|
|
echo "❌ Error: Failed to create symlink at $INSTALL_DIR/ccs"
|
|
echo "Check directory permissions and try again."
|
|
exit 1
|
|
fi
|
|
|
|
# Check if in PATH
|
|
if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then
|
|
echo "⚠️ Warning: $INSTALL_DIR is not in PATH"
|
|
echo ""
|
|
echo "Add to your shell profile (~/.bashrc or ~/.zshrc):"
|
|
echo " export PATH=\"\$HOME/.local/bin:\$PATH\""
|
|
echo ""
|
|
fi
|
|
|
|
echo "✅ Installation complete!"
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo "1. Copy example config: cp $SCRIPT_DIR/.ccs.example.json ~/.ccs.json"
|
|
echo "2. Edit ~/.ccs.json with your profile mappings"
|
|
echo "3. Run: ccs <profile>"
|
|
echo ""
|
|
echo "Example:"
|
|
echo " ccs glm"
|
|
echo " ccs sonnet --verbose"
|