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

cal at macports.org cal at macports.org
Tue Apr 23 14:33:59 PDT 2013


Revision: 105529
          https://trac.macports.org/changeset/105529
Author:   cal at macports.org
Date:     2013-04-23 14:33:59 -0700 (Tue, 23 Apr 2013)
Log Message:
-----------
port.tcl: print a less alarming and more user-friendly message if the portlist given to upgrade is empty

Previously "port upgrade outdated" with no outdated ports printed "Error: No
ports matched the given expression." which is correct but hard to understand
for users who don't know how to use the expression system and thus bad from
a UX POV.

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

Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl	2013-04-23 21:09:14 UTC (rev 105528)
+++ trunk/base/src/port/port.tcl	2013-04-23 21:33:59 UTC (rev 105529)
@@ -419,11 +419,20 @@
 
 
 # Supply a default porturl/portname if the portlist is empty
-proc require_portlist { nameportlist } {
+proc require_portlist { nameportlist {is_update "no"} } {
     global private_options
     upvar $nameportlist portlist
 
     if {[llength $portlist] == 0 && (![info exists private_options(ports_no_args)] || $private_options(ports_no_args) == "no")} {
+        if {${is_update} == "yes"} {
+            # $> port upgrade outdated
+            # Error: No ports matched the given expression
+            # is not very user friendly - if we're in the special case of
+            # "upgrade", let's print a message that's a little easier to
+            # understand and less alarming.
+            ui_msg "Nothing to upgrade."
+            return 1
+        }
         ui_error "No ports matched the given expression"
         return 1
     }
@@ -2633,7 +2642,7 @@
 
 
 proc action_upgrade { action portlist opts } {
-    if {[require_portlist portlist] || ([prefix_unwritable] && ![macports::global_option_isset ports_dryrun])} {
+    if {[require_portlist portlist "yes"] || ([prefix_unwritable] && ![macports::global_option_isset ports_dryrun])} {
         return 1
     }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130423/30def0f5/attachment-0001.html>


More information about the macports-changes mailing list