Created
February 28, 2014 08:17
-
-
Save islomar/9267285 to your computer and use it in GitHub Desktop.
Show Maven CLI with color
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
# Colorize Maven Output | |
# Colors reference: http://en.wikipedia.org/wiki/ANSI_escape_code | |
color_maven() { | |
$M2_HOME/bin/mvn $* | sed \ | |
-e 's/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/^[[32;1mTests run: \1^[[0m, Failures: ^[[31;1m\2^[[0m, Errors: ^[[33;1m\3^[[0m, Skipped: ^[[34;1m\4^[[0m/g' \ | |
-e 's/\(\[INFO\] \-[-]*$\)/^[[36;1m\1^[[0m/g' \ | |
-e 's/\(\[INFO\] Building.*\)/^[[36;1m\1^[[0m/g' \ | |
-e 's/\(.*WARN.*\)/^[[33;1m\1^[[0m/g' \ | |
-e 's/\(.*ERROR.*\)/^[[31;1m\1^[[0m/g' \ | |
-e 's/\(Downloaded:.*\)/^[[32;1m\1^[[0m/g' | |
} | |
alias mvn=color_maven | |
alias maven=$M2_HOME/bin/mvn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment