-
-
Save staslev/8383022 to your computer and use it in GitHub Desktop.
Make your maven output colorful to easily identify FAILURES and look a bit easier on the eye.
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
PURPLE=$(echo -en "\033[35m") | |
GREEN=$(echo -en "\033[32m") | |
RED=$(echo -en "\033[31m") | |
BLUE=$(echo -e "\033[1;34m") | |
NORMAL=$(echo -e "\033[0m") | |
mvn2() { | |
mvn $* | sed \ | |
-e " | |
s/^\(Failed tests:.*\)$/$RED\1$NORMAL/; # contains 'Failed tests:' | |
s/^\(.*\b[S][U][C][C][E][S][S]\b.*\)$/$GREEN\1$NORMAL/; # contains SUCCESS somewhere in the message | |
s/^\(.*\b[S][K][I][P][P][E][D]\b.*\)$/$PURPLE\1$NORMAL/;# contains SKIPPED somewhere in the message | |
s/^\(.*\bWARNING\b.*\)$/$PURPLE\1$NORMAL/; # contains WARNING somewhere in the message | |
s/^\(\bWARN\b.*\)$/$PURPLE\1$NORMAL/; # contains WARN somewhere in the message | |
s/^\(.*\bERROR\b.*\)$/$RED\1$NORMAL/; # contains ERROR somewhere in the message | |
s/^\(.*\bFAILURE\b.*\)$/$RED\1$NORMAL/; # contains FAILURE somewhere in the message | |
s/^\(Caused by*.*\)$/$RED\1$NORMAL/; # starts with 'Caused by' | |
s/^\(\tat .*\)$/$RED\1$NORMAL/; # starts with 'at ...' (stack trace) | |
s/^\(Tests run\b.*\)$/${BLUE}\1${NORMAL}/; # start with 'Tests run' | |
" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment