From 7f4117b05f9e4730657779ec7d4b3b08ba12616c Mon Sep 17 00:00:00 2001 From: Judd Vinet Date: Fri, 10 Oct 2003 01:10:18 +0000 Subject: added color to rc messages and fixed bug #168 --- functions | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'functions') diff --git a/functions b/functions index d79f30c..ab88827 100644 --- a/functions +++ b/functions @@ -3,26 +3,40 @@ # functions # -STAT_COL=68 +STAT_COL=$[`stty size | awk 'BEGIN { RS=" " }; END { print $1 }'` - 12] deltext() { echo -ne "\033[$(($STAT_COL+4))G" } stat_busy() { - echo -n "[ $1 " - awk "BEGIN { for (j=length(\"$1\"); j<$STAT_COL; j++) printf \" \" }" - echo -n " BUSY ]" + if [ "$USECOLOR" = "YES" -o "$USECOLOR" = "yes" ]; then + echo -ne "\033[1;32m| \033[1;37m$1\033[1;0m " + awk "BEGIN { for (j=length(\"$1\"); j<$STAT_COL; j++) printf \" \" }" + echo -ne " \033[1;34m[\033[1;33mbusy\033[1;34m]\033[1;0m" + else + echo -n "| $1 " + awk "BEGIN { for (j=length(\"$1\"); j<$STAT_COL; j++) printf \" \" }" + echo -n " [busy]" + fi } stat_done() { deltext - echo " DONE ]" + if [ "$USECOLOR" = "YES" -o "$USECOLOR" = "yes" ]; then + echo -e " \033[1;34m[\033[1;32mdone\033[1;34m]\033[1;0m" + else + echo " [done]" + fi } stat_fail() { deltext - echo " FAILED ]" + if [ "$USECOLOR" = "YES" -o "$USECOLOR" = "yes" ]; then + echo -e " \033[1;34m[\033[1;31mfail\033[1;34m]\033[1;0m" + else + echo " [fail]" + fi } stat_die() { -- cgit v1.2.3