Add a broke command: typing broke in a new Terminal starts it again (#1)

This commit is contained in:
minimus7 authored and GitHub committed 2026-11-09 17:05:00 -06:00
1 parent af66279940
commit 0d9ccfa209
3 files changed
+10 -3

No files matched your search

+8 -1
View File
@@ -11,4 +11,11 @@ command -v node >/dev/null || { echo "broke needs Node.js. Get the LTS version f
if [ -d "$DIR/.git" ]; then echo "broke is already in $DIR. Starting it."; else git clone --quiet "$REPO" "$DIR"; fi
cd "$DIR"
exec node scripts/start.mjs
# Adds a `broke` command, so a new Terminal window starts it again with one word.
LINE="alias broke='node \"$DIR/scripts/start.mjs\"'"
for RC in "$HOME/.zshrc" "$HOME/.bashrc" "$HOME/.bash_profile"; do
[ "$RC" = "$HOME/.zshrc" ] || [ -f "$RC" ] || continue # zsh is the Mac default; bash files only if they exist
grep -qxF "$LINE" "$RC" 2>/dev/null || printf '\n# broke\n%s\n' "$LINE" >> "$RC"
done
BROKE_TIP=1 exec node scripts/start.mjs