[121474] branches/gsoc14-interactive/base/src/registry2.0/portuninstall.tcl
Revision: 121474 https://trac.macports.org/changeset/121474 Author: shasha@macports.org Date: 2014-06-26 08:55:32 -0700 (Thu, 26 Jun 2014) Log Message: ----------- Added question for ambiguous uninstall Modified Paths: -------------- branches/gsoc14-interactive/base/src/registry2.0/portuninstall.tcl Modified: branches/gsoc14-interactive/base/src/registry2.0/portuninstall.tcl =================================================================== --- branches/gsoc14-interactive/base/src/registry2.0/portuninstall.tcl 2014-06-26 15:51:18 UTC (rev 121473) +++ branches/gsoc14-interactive/base/src/registry2.0/portuninstall.tcl 2014-06-26 15:55:32 UTC (rev 121474) @@ -89,15 +89,38 @@ if { [llength $ilist] > 1 } { # set portname again since the one we were passed may not have had the correct case set portname [[lindex $ilist 0] name] - ui_msg "$UI_PREFIX [msgcat::mc "The following versions of $portname are currently installed:"]" - foreach i [portlist_sortint $ilist] { + set msg "The following versions of $portname are currently installed:" + if {[macports::ui_isset ports_noninteractive]} { + ui_msg "$UI_PREFIX [msgcat::mc $msg]" + } + set sortedlist [portlist_sortint $ilist] + foreach i $sortedlist { set ispec "[$i version]_[$i revision][$i variants]" - if {[$i state] eq "installed"} { - ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s (active)"] [$i name] $ispec]" + ## + # User Interaction Question + # Asking choice to select option in case of ambiguous uninstall + if {[info exists macports::ui_options(questions_multichoice)]} { + if { [$i state] eq "installed" } { + lappend portilist [$i name]@[$i version]_[$i revision][$i variants](active) + } else { + lappend portilist [$i name]@[$i version]_[$i revision][$i variants] + } } else { - ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s"] [$i name] $ispec]" + if {[$i state] eq "installed"} { + ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s (active)"] [$i name] $ispec]" + } else { + ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s"] [$i name] $ispec]" + } } } + if {[info exists macports::ui_options(questions_multichoice)]} { + set retstring [$macports::ui_options(questions_multichoice) $msg "Choice_Q2" $portilist] + foreach index $retstring { + set uport [lindex $sortedlist [expr { $index - 1 }]] + uninstall [$uport name] [$uport version] [$uport revision] [$uport variants] + } + return 0 + } throw registry::invalid "Registry error: Please specify the full version as recorded in the port registry." } elseif { [llength $ilist] == 1 } { set port [lindex $ilist 0]
participants (1)
-
shasha@macports.org