_msg resets colors after use

This commit is contained in:
boyska 2012-01-29 16:25:16 +01:00
parent 17c0478240
commit 7de7f85109

View File

@ -48,8 +48,8 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin
function _msg() { function _msg() {
local command="print -P" local command="print -P"
local progname="$fg[magenta]${TOMBEXEC##*/}$fg[reset_color]" local progname="$fg[magenta]${TOMBEXEC##*/}$reset_color"
local message="$fg_bold[normal]$fg_no_bold[normal]${2}$fg[reset_color]" local message="$fg_bold[normal]$fg_no_bold[normal]${2}$reset_color"
local -i returncode local -i returncode
case "$1" in case "$1" in
@ -57,19 +57,19 @@ function _msg() {
command+=" -n"; pchars=" > "; pcolor="yellow" command+=" -n"; pchars=" > "; pcolor="yellow"
;; ;;
message) message)
pchars=" . "; pcolor="white"; message="$fg_no_bold[$pcolor]${2}$fg[reset_color]" pchars=" . "; pcolor="white"; message="$fg_no_bold[$pcolor]${2}$reset_color"
;; ;;
verbose) verbose)
pchars="[D]"; pcolor="blue" pchars="[D]"; pcolor="blue"
;; ;;
success) success)
pchars="(*)"; pcolor="green"; message="$fg_no_bold[$pcolor]${2}$fg[reset_color]" pchars="(*)"; pcolor="green"; message="$fg_no_bold[$pcolor]${2}$reset_color"
;; ;;
warning) warning)
pchars="[W]"; pcolor="yellow"; message="$fg_no_bold[$pcolor]${2}$fg[reset_color]" pchars="[W]"; pcolor="yellow"; message="$fg_no_bold[$pcolor]${2}$reset_color"
;; ;;
failure) failure)
pchars="[E]"; pcolor="red"; message="$fg_no_bold[$pcolor]${2}$fg[reset_color]" pchars="[E]"; pcolor="red"; message="$fg_no_bold[$pcolor]${2}$reset_color"
returncode=1 returncode=1
;; ;;
*) *)
@ -78,7 +78,7 @@ function _msg() {
returncode=127 returncode=127
;; ;;
esac esac
${=command} "${progname} $fg_bold[$pcolor]$pchars$fg[reset_color] ${message}$color[reset_color]" >&2 ${=command} "${progname} $fg_bold[$pcolor]$pchars$reset_color ${message}$color[reset_color]" >&2
return $returncode return $returncode
} }
function _message say() function _message say()