2019-04-27 22:09:36 +00:00
|
|
|
#! env zsh
|
2019-12-11 05:52:23 +00:00
|
|
|
# -*- sh -*-
|
2019-04-27 22:09:36 +00:00
|
|
|
R='\033[0;31m'
|
|
|
|
Y='\033[0;33m'
|
|
|
|
G='\033[0;32m'
|
2019-12-15 05:32:55 +00:00
|
|
|
MUTED='\033[0;37m'
|
2019-04-27 22:09:36 +00:00
|
|
|
NC='\033[0m' # No Color
|
|
|
|
|
|
|
|
format(){
|
|
|
|
case $1 in
|
2019-12-15 05:32:55 +00:00
|
|
|
"error") echo -e "$R ✘ $2$NC";;
|
|
|
|
"warn") echo -e "$Y ⚠ $2$NC";;
|
2020-03-09 17:30:45 +00:00
|
|
|
"pass") echo -e "$G ✔ $2$NC";;
|
|
|
|
"info") echo -e "$MUTED כֿ $2$NC";;
|
|
|
|
"debug") [ -v debug ] && $0 info $2 ; true ;;
|
2019-12-15 05:32:55 +00:00
|
|
|
"header") echo -e "=> $2";;
|
2019-04-27 22:09:36 +00:00
|
|
|
*) echo -e "$1: $2";;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
if [[ -z $2 ]] ; then
|
|
|
|
case "$LAST_RETURN" in
|
2020-03-09 17:30:45 +00:00
|
|
|
0) format pass $1;;
|
2019-04-27 22:09:36 +00:00
|
|
|
*) format error "FAILURE DURING: \"$1\"";;
|
|
|
|
esac
|
|
|
|
else
|
|
|
|
format $1 $2
|
|
|
|
fi
|
2019-12-11 05:52:23 +00:00
|
|
|
|