[121470] branches/gsoc14-interactive/base/src/registry2.0/portimage.tcl
Revision: 121470 https://trac.macports.org/changeset/121470 Author: shasha@macports.org Date: 2014-06-26 03:51:51 -0700 (Thu, 26 Jun 2014) Log Message: ----------- Added question for ambiguous activate Modified Paths: -------------- branches/gsoc14-interactive/base/src/registry2.0/portimage.tcl Modified: branches/gsoc14-interactive/base/src/registry2.0/portimage.tcl =================================================================== --- branches/gsoc14-interactive/base/src/registry2.0/portimage.tcl 2014-06-26 10:50:50 UTC (rev 121469) +++ branches/gsoc14-interactive/base/src/registry2.0/portimage.tcl 2014-06-26 10:51:51 UTC (rev 121470) @@ -220,18 +220,38 @@ set ilist [eval registry::entry imaged $searchkeys] if { [llength $ilist] > 1 } { - ui_msg "$UI_PREFIX [msgcat::mc "The following versions of $name are currently installed:"]" + set portilist {} + set msg "The following versions of $name are currently installed:" + if {[macports::ui_isset ports_noninteractive]} { + ui_msg "$UI_PREFIX [msgcat::mc $msg]" + } foreach i $ilist { set iname [$i name] set iversion [$i version] set irevision [$i revision] set ivariants [$i variants] - if { [$i state] eq "installed" } { - ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s (active)"] $iname $iversion $irevision $ivariants]" + ## + # User Interaction Question + # Asking choice to select option in case of ambiguous activate + if {[info exists macports::ui_options(questions_singlechoice)]} { + if { [$i state] eq "installed" } { + lappend portilist $iname@${iversion}_${irevision}${ivariants}(active) + } else { + lappend portilist $iname@${iversion}_${irevision}${ivariants} + } } else { - ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s"] $iname $iversion $irevision $ivariants]" + if { [$i state] eq "installed" } { + ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s (active)"] $iname $iversion $irevision $ivariants]" + } else { + ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s"] $iname $iversion $irevision $ivariants]" + } } } + if {[info exists macports::ui_options(questions_singlechoice)]} { + set retvalue [$macports::ui_options(questions_singlechoice) $msg "Choice_Q1" $portilist] + set index [expr { $retvalue - 1 }] + return [lindex $ilist $index] + } throw registry::invalid "Registry error: Please specify the full version as recorded in the port registry." } elseif { [llength $ilist] == 1 } { return [lindex $ilist 0]
participants (1)
-
shasha@macports.org