owenrusk.dev

dotfiles

shell, editor, ssh.

git clone https://owenrusk.dev/dotfiles.git

commit 83be5508697add9eb9eb2aab6038eb53dcd39528
parent 6f2343e33b26e807c323d3ddb7805769654aefcc
author Owen Rusk <owen@papermothgames.com>
date   2025-07-22 13:30:16 -0500
bin: srcstat
bin/srcstat+12-0
diff --git a/bin/srcstat b/bin/srcstat
new file mode 100755
index 0000000..15709b5
--- /dev/null
+++ b/bin/srcstat
@@ -0,0 +1,12 @@
+#!/bin/sh
+# what's uncommitted or unpushed under ~/src. "-" ahead means no upstream.
+src=${SRC:-$HOME/src}
+
+for dir in "$src"/*/; do
+    [ -d "$dir.git" ] || continue
+    name=$(basename "$dir")
+    changed=$(git -C "$dir" status --porcelain | wc -l | tr -d ' ')
+    ahead=$(git -C "$dir" rev-list --count '@{upstream}..HEAD' 2>/dev/null || echo -)
+    [ "$changed" = 0 ] && [ "$ahead" = 0 ] && continue
+    printf '%-24s %4s changed %4s ahead\n' "$name" "$changed" "$ahead"
+done