* commit '01e0cb2ce011e65099737ca6052d10758d885c8b': Consult tput about color control sequence support
This commit is contained in:
commit
e39b0c118a
1 changed files with 13 additions and 13 deletions
26
envsetup.sh
26
envsetup.sh
|
@ -1447,19 +1447,21 @@ function make()
|
|||
local hours=$(($tdiff / 3600 ))
|
||||
local mins=$((($tdiff % 3600) / 60))
|
||||
local secs=$(($tdiff % 60))
|
||||
local ncolors=$(tput colors 2>/dev/null)
|
||||
if [ -n "$ncolors" ] && [ $ncolors -ge 8 ]; then
|
||||
color_failed="\e[0;31m"
|
||||
color_success="\e[0;32m"
|
||||
color_reset="\e[00m"
|
||||
else
|
||||
color_failed=""
|
||||
color_success=""
|
||||
color_reset=""
|
||||
fi
|
||||
echo
|
||||
if [ $ret -eq 0 ] ; then
|
||||
if [ $(uname) != "Darwin" ]; then
|
||||
echo -n -e "\e[0;32m#### make completed successfully "
|
||||
else
|
||||
echo -n -e "#### make completed successfully "
|
||||
fi
|
||||
echo -n -e "${color_success}#### make completed successfully "
|
||||
else
|
||||
if [ $(uname) != "Darwin" ]; then
|
||||
echo -n -e "\e[0;31m#### make failed to build some targets "
|
||||
else
|
||||
echo -n -e "#### make failed to build some targets "
|
||||
fi
|
||||
echo -n -e "${color_failed}#### make failed to build some targets "
|
||||
fi
|
||||
if [ $hours -gt 0 ] ; then
|
||||
printf "(%02g:%02g:%02g (hh:mm:ss))" $hours $mins $secs
|
||||
|
@ -1468,9 +1470,7 @@ function make()
|
|||
elif [ $secs -gt 0 ] ; then
|
||||
printf "(%s seconds)" $secs
|
||||
fi
|
||||
if [ $(uname) != "Darwin" ]; then
|
||||
echo -e " ####\e[00m"
|
||||
fi
|
||||
echo -e " ####${color_reset}"
|
||||
echo
|
||||
return $ret
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue