Last active
December 27, 2015 10:59
-
-
Save Querela/7315123 to your computer and use it in GitHub Desktop.
[*nix][shell][script][java][build] Colorize ant output and remove warnings.Usage: antx.sh <anttarget>
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 | |
# colorizes an ant command | |
anttask="$1" | |
##################################################################### | |
echo -e "\033[31m### ANTTASK: ant $anttask ###\033[30m" | |
# Process command output | |
ant $anttask 2>&1 | while read line | |
do | |
# ignore warnings | |
if [ "$line" != "${line/Trying to override old definition of/}" ]; then | |
continue | |
fi | |
# color all output in the format: "[xxx] xxx" -> braces | |
line="${line//[/\033[34m[}" | |
line="${line//]/]\033[33m}" | |
# color the result | |
if [ "$line" != "${line/BUILD/}" ]; then | |
if [ "$line" != "${line/SUCCESSFUL/}" ]; then | |
# successful | |
line="${line/BUILD/\033[42m\033[31m### BUILD} ###" | |
else | |
# failed | |
line="${line/BUILD/\033[40m\033[31m### BUILD} ###" | |
fi | |
fi | |
# echo line | |
echo -e $line "\033[30m\033[49m" | |
done | |
#echo -e "\033[0m\033[49m" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment