dotfiles/lib/helper/report

24 lines
405 B
Plaintext
Raw Normal View History

#! env zsh
R='\033[0;31m'
Y='\033[0;33m'
G='\033[0;32m'
NC='\033[0m' # No Color
format(){
case $1 in
"error") echo -e "$R ✘ $2$NC";;
"warn") echo -e "$Y ⚠ $2$NC";;
"info") echo -e "$G ✔ $2$NC";;
*) echo -e "$1: $2";;
esac
}
if [[ -z $2 ]] ; then
case "$LAST_RETURN" in
0) format info $1;;
*) format error "FAILURE DURING: \"$1\"";;
esac
else
format $1 $2
fi