[146713] trunk/base/src/port/port.tcl

ijackson at macports.org ijackson at macports.org
Tue Mar 15 10:28:46 PDT 2016


Revision: 146713
          https://trac.macports.org/changeset/146713
Author:   ijackson at macports.org
Date:     2016-03-15 10:28:46 -0700 (Tue, 15 Mar 2016)
Log Message:
-----------
Add option for selecting all options in multichoice.

Consider none when no option is entered. Print valid
option choices when asking the user to enter the option(s).

Modified Paths:
--------------
    trunk/base/src/port/port.tcl

Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl	2016-03-15 17:11:22 UTC (rev 146712)
+++ trunk/base/src/port/port.tcl	2016-03-15 17:28:46 UTC (rev 146713)
@@ -5521,7 +5521,12 @@
 
         # User Input (with Multiple input parsing)
         while 1 {
-            puts -nonewline "Enter the numbers to select the options: "
+            if {[llength $ports] > 1} {
+                set option_range "1-[llength $ports]"
+            } else {
+                set option_range "1"
+            }
+            puts -nonewline "Enter option(s) \[$option_range/all\]: "
             flush stdout
             signal error {TERM INT}
             try {
@@ -5535,9 +5540,19 @@
             signal -restart error {TERM INT}
             # check if input is non-empty and otherwise fine
             if {$input == ""} {
-                continue
+                return []
             }
 
+            if {[string equal -nocase $input "all"]} {
+                set count 0
+                set options_seq []
+                foreach port $ports {
+                    lappend options_seq $count
+                    incr count
+                }
+                return $options_seq    
+            }
+
             if {[llength $input] > [llength $ports]} {
                 puts "Extra indices present. Please enter option(s) only once."
                 continue
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160315/316f8157/attachment.html>


More information about the macports-changes mailing list