#!/usr/bin/env bash # Clone this kit and your own repos side by side into one workspace folder. # The kit is the hackathon/ folder of the ta-amps/ta-amps-hackathon repo, so it lands in ta-amps-hackathon/hackathon/. # Usage: scripts/bootstrap-workspace.sh WORKSPACE_DIR [REPO ...] # REPO is owner/name (cloned from GitHub) or any git URL. # Example: scripts/bootstrap-workspace.sh ~/hackathon you/your-app you/your-backend # Uses `gh repo clone` for owner/name when gh is installed and signed in, otherwise git over HTTPS. set -euo pipefail KIT="ta-amps/ta-amps-hackathon" WORKSPACE="${1:?usage: scripts/bootstrap-workspace.sh WORKSPACE_DIR [REPO ...]}" shift mkdir -p "$WORKSPACE" cd "$WORKSPACE" clone() { local spec="$1" dir dir="$(basename "${spec%.git}")" if [ -d "$dir/.git" ]; then echo "skip $dir (already cloned)" return fi case "$spec" in *://*|git@*) git clone "$spec" "$dir" ;; */*) if command -v gh >/dev/null 2>&1 && gh auth status >/dev/null 2>&1; then gh repo clone "$spec" "$dir" else git clone "https://github.com/$spec.git" "$dir" fi ;; *) echo "not a repo: $spec (use owner/name or a git URL)" >&2; return 1 ;; esac echo "cloned $dir" } clone "$KIT" for repo in "$@"; do clone "$repo"; done cat <