Revision
105529
Author
cal@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

Diff

Modified: trunk/base/src/port/port.tcl (105528 => 105529)


--- 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
     }