[141657] users/ryandesign/scripts/waitport

ryandesign at macports.org ryandesign at macports.org
Sat Dec 12 02:27:29 PST 2015


Revision: 141657
          https://trac.macports.org/changeset/141657
Author:   ryandesign at macports.org
Date:     2015-10-25 08:27:46 -0700 (Sun, 25 Oct 2015)
Log Message:
-----------
waitport: add message and progress indicator

Modified Paths:
--------------
    users/ryandesign/scripts/waitport

Modified: users/ryandesign/scripts/waitport
===================================================================
--- users/ryandesign/scripts/waitport	2015-10-25 15:07:40 UTC (rev 141656)
+++ users/ryandesign/scripts/waitport	2015-10-25 15:27:46 UTC (rev 141657)
@@ -10,6 +10,21 @@
     exit 1
 fi
 
+PROGRESS_CHARS="/-\\|"
+PROGRESS_INDEX=0
+MESSAGE="Waiting for MacPorts to finish what it's doing... "
+
+cleanup() {
+    printf "\r%${#MESSAGE}s   \r"
+    tput cnorm
+    exit 0
+}
+
+trap cleanup INT
+tput civis
 while [ -n "$(ps aww | grep "$PORT_TCLSH" | grep -v grep)" ]; do
+    printf "\r${MESSAGE}${PROGRESS_CHARS:$PROGRESS_INDEX:1}"
+    PROGRESS_INDEX=$((($PROGRESS_INDEX + 1) % ${#PROGRESS_CHARS}))
     sleep 1
 done
+cleanup
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20151212/452f78b7/attachment.html>


More information about the macports-changes mailing list