[Lunar-commits] <lunar> Cap progressbar at 100%

Auke Kok sofar at foo-projects.org
Wed Jun 15 07:44:39 CEST 2011


commit 87d49a569637105640e83005004438e7351cf98d
Author: Auke Kok <sofar at foo-projects.org>
Date:   Tue Jun 14 22:44:39 2011 -0700

    Cap progressbar at 100%
---
 var/lib/lunar/functions/logging.lunar |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/var/lib/lunar/functions/logging.lunar b/var/lib/lunar/functions/logging.lunar
index e1f8704..2d539fc 100644
--- a/var/lib/lunar/functions/logging.lunar
+++ b/var/lib/lunar/functions/logging.lunar
@@ -49,15 +49,15 @@ progress() {
       if [ $STATUS -gt 128 ]; then
         sleep 2
       elif [ $STATUS -eq 1 ]; then
-        echo -ne "\r [${X:0:60}] (100%)"
+        echo -ne "\r [${X:0:60}] (100%)\r"
         exit
       fi
       (( S += ${#LINE} ))
+      if [[ $S -gt OLDSZ ]]; then
+        S=$OLDSZ
+      fi
       PC=$((S * 100 / OLDSZ))
       L=$((S * 60 / OLDSZ))
-      if [[ $L -gt 60 ]]; then
-        ((L=60))
-      fi
       echo -ne "\r [${X:0:$L}${Y:0:$((60 - L))}] ($PC%)\r"
     done
   else


More information about the Lunar-commits mailing list