Created
February 10, 2016 09:41
Revisions
-
weiserr created this gist
Feb 10, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ # Wrapper function for Maven's mvn command. mvn-color() { # Formatting constants BOLD=$(echo -e "\e[1m") TEXT_RED=$(echo -e "\e[31m") TEXT_GREEN=$(echo -e "\e[32m") TEXT_YELLOW=$(echo -e "\e[33m") TEXT_BLUE=$(echo -e "\e[34m") RESET_FORMATTING=$(echo -e "\e[0m") # Filter mvn output using sed mvn-redirect $@ | sed -e "s/\(\[INFO\].*\)/${TEXT_BLUE}${BOLD}\1/g" \ -e "s/\(\[WARNING\].*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}/g" \ -e "s/\(\[ERROR\].*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}/g" \ -e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/${BOLD}${TEXT_GREEN}Tests run: \1${RESET_FORMATTING}, Failures: ${BOLD}${TEXT_RED}\2${RESET_FORMATTING}, Errors: ${BOLD}${TEXT_RED}\3${RESET_FORMATTING}, Skipped: ${BOLD}${TEXT_YELLOW}\4${RESET_FORMATTING}/g" # Make sure formatting is reset echo -ne ${RESET_FORMATTING} } # Override the mvn command with the colorized one. alias mvn="mvn-color"