summaryrefslogtreecommitdiff
path: root/.local/bin/prompt-git
blob: 54e60f639cd04efab22d9e2d350ae6e9280ad8c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
git rev-parse --show-toplevel >/dev/null 2>&1 && 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"
	printf '%s' ")"
}