Skip to content

Instantly share code, notes, and snippets.

@StewartLynch
Created March 18, 2026 18:35
Show Gist options
  • Select an option

  • Save StewartLynch/194551c95e3181239262ca160c993da3 to your computer and use it in GitHub Desktop.

Select an option

Save StewartLynch/194551c95e3181239262ca160c993da3 to your computer and use it in GitHub Desktop.
TUIKit Load Status Function
func loadStatus() {
projectName = shell("basename \"\(launchDir)\"")
branch = shell("git -C \"\(launchDir)\" rev-parse --abbrev-ref HEAD 2>/dev/null || echo '(not a git repo)'")
lastCommit = shell("git -C \"\(launchDir)\" log -1 --pretty=format:'%h %s' 2>/dev/null")
let raw = shell("git -C \"\(launchDir)\" status --porcelain 2>/dev/null | wc -l | tr -d ' '")
changedFiles = raw.isEmpty ? "–" : raw
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment