[Lunar-commits] <lunar> Newline when done, and never print 100% unless you're really done - stick at 99%.

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


commit c176358774cbe72747b64962a790a29553491c50
Author: Auke Kok <sofar at foo-projects.org>
Date:   Tue Jun 14 22:51:19 2011 -0700

    Newline when done, and never print 100% unless you're really done - stick at 99%.
---
 var/lib/lunar/functions/logging.lunar |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

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


More information about the Lunar-commits mailing list