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

ijackson at macports.org ijackson at macports.org
Mon Mar 14 11:27:13 PDT 2016


Revision: 146639
          https://trac.macports.org/changeset/146639
Author:   ijackson at macports.org
Date:     2016-03-14 11:27:13 -0700 (Mon, 14 Mar 2016)
Log Message:
-----------
Add an optional argument to proc ask_ui_yesno

Add an optional argument to proc ask_ui_yesno
for custom question message with default as "Continue?".
Handle extra new line when the $ports is empty.

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

Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl	2016-03-14 17:15:44 UTC (rev 146638)
+++ trunk/base/src/port/port.tcl	2016-03-14 18:27:13 UTC (rev 146639)
@@ -5391,7 +5391,7 @@
 	#        The default answer to the question.
 	# @param time
 	# 		 The amount of time for which a timeout is to occur.
-	proc ui_ask_yesno {msg name ports def {timeout 0}} {
+	proc ui_ask_yesno {msg name ports def {timeout 0} {question "Continue?"}} {
 		# Set number default to the given letter default
 		if {$def == {y}} {
 			set default 0
@@ -5406,6 +5406,7 @@
 		if {[llength $ports] == 1} {
 			puts -nonewline " "
 			puts [string map {@ " @"} $ports]
+		} elseif {[llength $ports] == 0} {
 		} else {
 			puts ""
 			foreach port $ports {
@@ -5422,10 +5423,10 @@
 				
 		# Check for the default and print accordingly
 		if {$def == {y}} {
-			puts -nonewline "Continue? \[Y/n\]: "
+			puts -nonewline "${question} \[Y/n\]: "
 			flush stdout
 		} else {
-			puts -nonewline "Continue? \[y/N\]: "
+			puts -nonewline "${question} \[y/N\]: "
 			flush stdout
 		}
 		
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160314/9a158723/attachment.html>


More information about the macports-changes mailing list