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
diff --git a/envsetup.sh b/envsetup.sh
index b118e5a..0ab15ae 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -1236,6 +1236,19 @@
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
case `ps -o command -p $$` in
*bash*)