Created
February 5, 2015 19:03
-
-
Save nickboldt/fab71da10bd5169ffdfa to your computer and use it in GitHub Desktop.
add colour to git branch info
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# http://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux | |
red="$(tput setaf 1)" | |
green="$(tput setaf 2)" | |
blue="$(tput setaf 4)" | |
white="$(tput setaf 7;tput dim)" | |
underline_on="$(tput smul)" | |
underline_off="$(tput rmul)" | |
echo -n $white"git branch -v" | |
git branch -v | sed -e "s/\(\[behind\|, behind \)/$red\1/" -e "s/\(\[ahead\)/$green\1/" -e "s/\]/\]$white/" \ | |
-e "s#\(\(JBIDE\|JBDS\)-[0-9]\+\)#$blue\1$white#g" \ | |
-e "s#\([0-9]\+\.[0-9]\+\.[0-9]\+\([0-9_.]\+\|.SNAPSHOT\)\)#${underline_on}\1${underline_off}#g" \ | |
-e "s#\([0-9]\+\.[0-9]\+\.[0-9]\+\(\(.Final\|.CR\|.Beta\|.Alpha\|.\)[0-9_.]\+\)\)#${underline_on}\1${underline_off}#g" \ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment