~cytrogen/gstack

ref: 4fe0ce9cba4b367a36004720cddb952172e7949d gstack/bin/gstack-slug -rwxr-xr-x 476 bytes
4fe0ce9c — Garry Tan feat: natural language skill routing + proactive suggestions (v0.7.1) (#195) a month ago
                                                                                
1
2
3
4
5
6
7
8
9
#!/usr/bin/env bash
# gstack-slug — output project slug and sanitized branch name
# Usage: eval $(gstack-slug)  → sets SLUG and BRANCH variables
# Or:    gstack-slug           → prints SLUG=... and BRANCH=... lines
set -euo pipefail
SLUG=$(git remote get-url origin 2>/dev/null | sed 's|.*[:/]\([^/]*/[^/]*\)\.git$|\1|;s|.*[:/]\([^/]*/[^/]*\)$|\1|' | tr '/' '-')
BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null | tr '/' '-')
echo "SLUG=$SLUG"
echo "BRANCH=$BRANCH"