Skip to content

Commit

Permalink
Show if branch is behind remote
Browse files Browse the repository at this point in the history
  • Loading branch information
pablopunk committed Jan 19, 2021
1 parent b20b716 commit c0620fb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 5 additions & 2 deletions bashy
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,23 @@ symbol_clean="\x01\033[39m\x02✓" # foreground
symbol_delete="\x01\033[31m\x02⨯" # red
symbol_new="\x01\033[36m\x02+" # cyan
symbol_change="\x01\033[33m\x02•" # yellow
symbol_ahead="\x01\033[33m\x02↑" # yellow
symbol_behind="\x01\033[34m\x02↓" # blue
symbol_ahead="\x01\033[32m\x02↑" # green

delete=0; change=0; new=0; ahead=0
delete=0; change=0; new=0; ahead=0; behind=0

for line in $gitstatus; do
[[ $line =~ ^D ]] && delete=1
[[ $line =~ ^M ]] && change=1
[[ $line =~ ^\?\? ]] && new=1
[[ $line =~ behind ]] && behind=1
[[ $line =~ ahead ]] && ahead=1
done

[ $delete -eq 1 ] && symbols="$symbols$symbol_delete"
[ $change -eq 1 ] && symbols="$symbols$symbol_change"
[ $new -eq 1 ] && symbols="$symbols$symbol_new"
[ $behind -eq 1 ] && symbols="$symbols$symbol_behind"
[ $ahead -eq 1 ] && symbols="$symbols$symbol_ahead"

[ -z "$symbols" ] && symbols="$symbol_clean"
Expand Down
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c0620fb

Please sign in to comment.