Shrink boilerplate function

This commit is contained in:
Kevin van Zonneveld 2014-07-23 11:30:53 +02:00
parent 3f8ac03553
commit 17e7677757

View File

@ -53,12 +53,10 @@ function _fmt () {
color="${color_ok}" color="${color_ok}"
fi fi
color_reset="\x1b[0m"
local color_reset="\x1b[0m" local color_reset="\x1b[0m"
if [[ "${TERM}" != "xterm"* ]] || [ -t 1 ]; then if [[ "${TERM}" != "xterm"* ]] || [ -t 1 ]; then
# Don't use colors on pipes or non-recognized terminals # Don't use colors on pipes or non-recognized terminals
color="" color=""; color_reset=""
color_reset=""
fi fi
echo -e "$(date -u +"%Y-%m-%d %H:%M:%S UTC") ${color}$(printf "[%9s]" ${1})${color_reset}"; echo -e "$(date -u +"%Y-%m-%d %H:%M:%S UTC") ${color}$(printf "[%9s]" ${1})${color_reset}";
} }