Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f0d08ebd authored by Alex Ray's avatar Alex Ray
Browse files

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
parent 24753394
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -1236,6 +1236,19 @@ function set_java_home() {
    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*)