Hop, a somewhat more efficient progress bar, less CPU consuming, if that was a problem :-)

(a litlle recreation while toochains are building...)
This commit is contained in:
Yann E. MORIN" 2007-05-08 20:41:08 +00:00
parent 9bed636293
commit 823a283d19
2 changed files with 7 additions and 5 deletions

View File

@ -45,12 +45,13 @@ if [ "${CT_LOG_PROGRESS_BAR}" = "y" ]; then
printf "[%02d:%02d]" $((elapsed/60)) $((elapsed%60))
}
_CT_PROG_BAR() {
[ $((cpt/10)) -eq 0 ] && echo -en "\r`_CT_PROG_BAR_DATE` /"
[ $((cpt/10)) -eq 1 ] && echo -en "\r`_CT_PROG_BAR_DATE` -"
[ $((cpt/10)) -eq 2 ] && echo -en "\r`_CT_PROG_BAR_DATE` \\"
[ $((cpt/10)) -eq 3 ] && echo -en "\r`_CT_PROG_BAR_DATE` |"
cpt=$(((cpt+1)%40))
[ ${CT_PROG_BAR_CPT} -eq 0 ] && echo -en "\r`_CT_PROG_BAR_DATE` /"
[ ${CT_PROG_BAR_CPT} -eq 10 ] && echo -en "\r`_CT_PROG_BAR_DATE` -"
[ ${CT_PROG_BAR_CPT} -eq 20 ] && echo -en "\r`_CT_PROG_BAR_DATE` \\"
[ ${CT_PROG_BAR_CPT} -eq 30 ] && echo -en "\r`_CT_PROG_BAR_DATE` |"
CT_PROG_BAR_CPT=$(((CT_PROG_BAR_CPT+1)%40))
}
CT_PROG_BAR_CPT=0
CT_PROG_BAR=_CT_PROG_BAR
export -f _CT_PROG_BAR
else

View File

@ -91,6 +91,7 @@ CT_DoLog() {
normal="CT_NORMAL_COLOR"
if [ ${cur_l} -le ${max_level} ]; then
echo -e "\r${!color}${l}${!normal}"
CT_PROG_BAR_CPT=0 # Force redrawing progress bar on next 'unlogged' line
else
${CT_PROG_BAR}
fi