pez: colored SUCCESS/FAILURE indicator

pez is a new bash function that can be prepended to existing functions
or commands to clearly show a colored exit status.

Example:
$ pez mmm frameworks/base/etc

will print all the usual output, and at the end either a green "SUCCESS"
line or a red "FAILURE" line.

Change-Id: I7e369b0280d6ece16fb0be1895278c26922491fe
This commit is contained in:
Alex Ray 2013-03-08 15:15:06 -08:00
parent 24753394b9
commit f0d08ebd2f
1 changed files with 13 additions and 0 deletions

View File

@ -1236,6 +1236,19 @@ function set_java_home() {
fi fi
} }
# Print colored exit condition
function pez {
$@
retval=$?
if [ $retval -ne 0 ]
then
echo -e "\e[0;31mFAILURE\e[00m"
else
echo -e "\e[0;32mSUCCESS\e[00m"
fi
return $retval
}
if [ "x$SHELL" != "x/bin/bash" ]; then if [ "x$SHELL" != "x/bin/bash" ]; then
case `ps -o command -p $$` in case `ps -o command -p $$` in
*bash*) *bash*)