diff options
| author | Mike Vink <ivi@vinkies.net> | 2025-02-09 16:41:00 +0100 |
|---|---|---|
| committer | Mike Vink <ivi@vinkies.net> | 2025-02-09 16:41:00 +0100 |
| commit | 439dc96e5a80cc15952cded1f432185ed97f8c69 (patch) | |
| tree | 98f3db5369f126d4e80079a6b0244dc6ea3a8fb6 | |
| parent | 8fdb45927ee1dec908b455b517f9c0dd893df2b4 (diff) | |
show some git status
| -rwxr-xr-x | .local/bin/prompt-git | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/.local/bin/prompt-git b/.local/bin/prompt-git index 3d9b928..edfaf66 100755 --- a/.local/bin/prompt-git +++ b/.local/bin/prompt-git @@ -1 +1,12 @@ -[ -d .git ] && git status --porcelain=v1 | { while read tag file; do case $tag in M) modified=$(( modified + 1));; ?*) untracked=$(( untracked + 1));; esac ; done; echo "git(M$modified|?$untracked)"; } +[ -d .git ] && git status --porcelain=v1 | { + while read tag file; do + case $tag in + M) modified=$(( modified + 1));; + ?*) untracked=$(( untracked + 1));; + esac ; + done; + printf '%s' " git($(git branch --show-current)" + [ 0 -lt "${modified:-0}" ] && printf '%s' ":M$modified" + [ 0 -lt "${untracked:-0}" ] && printf '%s' "|?$untracked" + echo ")" +} |
