Commit 4714410e authored by Vitaly Lipatov's avatar Vitaly Lipatov

use colors for fatal, warning and info messages

parent 2bc03dfa
...@@ -22,16 +22,18 @@ print_message() ...@@ -22,16 +22,18 @@ print_message()
local DESC="$1" local DESC="$1"
shift shift
if [ -z "$TEXTDOMAIN" ] ; then if [ -z "$TEXTDOMAIN" ] ; then
echo "$DESC in $(basename $0): $@" | colorify >&2 echo "$DESC in $(basename $0): $@" >&2
else else
echog "$DESC in $(basename $0): $@" | colorify >&2 echog "$DESC in $(basename $0): $@" >&2
fi fi
} }
# Print error message and stop the program # Print error message and stop the program
fatal() fatal()
{ {
SETCOLOR_FAILURE
print_message Error "$@" print_message Error "$@"
SETCOLOR_NORMAL
if [ -n "$ETERSOFT_FATAL_REMOVE_FILES" ]; then if [ -n "$ETERSOFT_FATAL_REMOVE_FILES" ]; then
rm -rvf $ETERSOFT_FATAL_REMOVE_FILES rm -rvf $ETERSOFT_FATAL_REMOVE_FILES
fi fi
...@@ -56,7 +58,9 @@ isatty2() ...@@ -56,7 +58,9 @@ isatty2()
# Just print warning message # Just print warning message
warning() warning()
{ {
SETCOLOR_WARNING
print_message Warning "$@" print_message Warning "$@"
SETCOLOR_NORMAL
} }
info() info()
...@@ -66,7 +70,9 @@ info() ...@@ -66,7 +70,9 @@ info()
# print message to stderr if stderr forwarded to (a file) # print message to stderr if stderr forwarded to (a file)
if isatty2 ; then if isatty2 ; then
isatty || return 0 isatty || return 0
SETCOLOR_WARNING
echo "$@" echo "$@"
SETCOLOR_NORMAL
else else
echo "$@" >&2 echo "$@" >&2
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment