claude-launcher-profiles/bin/install-claude-profiles

31 lines
850 B
Text
Raw Normal View History

2026-06-28 01:50:13 +02:00
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
TARGET_DIR="$HOME/src"
TARGET_REPO="$TARGET_DIR/claude-launcher-profiles"
BASHRC="$HOME/.bashrc"
ALIAS_LINE="source $TARGET_REPO/shell/aliases.sh"
mkdir -p "$TARGET_DIR"
if [[ "$REPO_DIR" != "$TARGET_REPO" ]]; then
if [[ -L "$TARGET_REPO" ]]; then
ln -sfn "$REPO_DIR" "$TARGET_REPO"
elif [[ -e "$TARGET_REPO" ]]; then
echo "Warning: $TARGET_REPO exists and is not a symlink;" >&2
echo " aliases will point there. Remove it to repoint to $REPO_DIR." >&2
else
2026-06-28 01:50:13 +02:00
ln -s "$REPO_DIR" "$TARGET_REPO"
fi
fi
touch "$BASHRC"
if ! grep -Fq "$ALIAS_LINE" "$BASHRC"; then
2026-06-28 01:50:13 +02:00
printf '\n# claude-launcher-profiles\n%s\n' "$ALIAS_LINE" >> "$BASHRC"
fi
echo "Installed. Run: source ~/.bashrc"