Changeset 146639 for trunk/base


Ignore:
Timestamp:
Mar 14, 2016, 6:27:13 PM (4 years ago)
Author:
ijackson@…
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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port/port.tcl

    r145921 r146639  
    53925392        # @param time
    53935393        #                The amount of time for which a timeout is to occur.
    5394         proc ui_ask_yesno {msg name ports def {timeout 0}} {
     5394        proc ui_ask_yesno {msg name ports def {timeout 0} {question "Continue?"}} {
    53955395                # Set number default to the given letter default
    53965396                if {$def == {y}} {
     
    54075407                        puts -nonewline " "
    54085408                        puts [string map {@ " @"} $ports]
     5409                } elseif {[llength $ports] == 0} {
    54095410                } else {
    54105411                        puts ""
     
    54235424                # Check for the default and print accordingly
    54245425                if {$def == {y}} {
    5425                         puts -nonewline "Continue? \[Y/n\]: "
     5426                        puts -nonewline "${question} \[Y/n\]: "
    54265427                        flush stdout
    54275428                } else {
    5428                         puts -nonewline "Continue? \[y/N\]: "
     5429                        puts -nonewline "${question} \[y/N\]: "
    54295430                        flush stdout
    54305431                }
Note: See TracChangeset for help on using the changeset viewer.