[45977] contrib/port_cutleaves/port_cutleaves

raimue at macports.org raimue at macports.org
Mon Jan 26 02:21:20 PST 2009


Revision: 45977
          http://trac.macports.org/changeset/45977
Author:   raimue at macports.org
Date:     2009-01-26 02:21:20 -0800 (Mon, 26 Jan 2009)
Log Message:
-----------
contrib/port_cutleaves:
Ask again if the answer was not one of the given choices

Modified Paths:
--------------
    contrib/port_cutleaves/port_cutleaves

Modified: contrib/port_cutleaves/port_cutleaves
===================================================================
--- contrib/port_cutleaves/port_cutleaves	2009-01-26 08:52:25 UTC (rev 45976)
+++ contrib/port_cutleaves/port_cutleaves	2009-01-26 10:21:20 UTC (rev 45977)
@@ -37,6 +37,7 @@
 
     set current_leaf    1
     set to_uninstall    {}
+    set flush_now 0
 
     foreach leaf $to_process {
         set composite_version   [composite_version $leaf]
@@ -48,27 +49,43 @@
             set status Inactive
         }
 
-        puts "\[Leaf $current_leaf of $total_leaves] $full_name ($status):"
-        puts -nonewline "  \[keep] / (u)ninstall / (f)lush / (a)bort: "
-        flush stdout
+        while {1} {
+            puts "\[Leaf $current_leaf of $total_leaves] $full_name ($status):"
+            puts -nonewline "  \[keep] / (u)ninstall / (f)lush / (a)bort: "
+            flush stdout
 
-        gets stdin action
-        switch -glob $action {
-            a* {
-                puts "\nAborting port_cutleaves..."
-                return $exit_status
+            gets stdin action
+            switch -glob $action {
+                a* {
+                    puts "\nAborting port_cutleaves..."
+                    return $exit_status
+                }
+                f* {
+                    puts "\nFlushing any uninstallation operations...\n"
+                    set flush_now 1
+                }
+                u* {
+                    puts "** $full_name will be uninstalled.\n"
+                    lappend to_uninstall $leaf
+                }
+                k* -
+                ""
+                {
+                    puts "** $full_name will be kept.\n"
+                }
+                default {
+                    puts "** Invalid answer.\n"
+                    continue
+                }
             }
-            f* {
-                puts "\nFlushing any uninstallation operations...\n"
-                break
-            }
-            u* {
-                puts "** $full_name will be uninstalled.\n"
-                lappend to_uninstall $leaf
-            }
-            default { puts "** $full_name will be kept.\n" }
+
+            break
         }
 
+        if {$flush_now == 1} {
+            break
+        }
+
         set current_leaf [expr $current_leaf + 1]
     }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090126/130f7d53/attachment.html>


More information about the macports-changes mailing list