[100061] contrib/portfile-gen/portfile-gen

raimue at macports.org raimue at macports.org
Sun Nov 25 11:05:46 PST 2012


Revision: 100061
          https://trac.macports.org/changeset/100061
Author:   raimue at macports.org
Date:     2012-11-25 11:05:46 -0800 (Sun, 25 Nov 2012)
Log Message:
-----------
portfile-gen:
Print error messages to stderr

Modified Paths:
--------------
    contrib/portfile-gen/portfile-gen

Modified: contrib/portfile-gen/portfile-gen
===================================================================
--- contrib/portfile-gen/portfile-gen	2012-11-25 18:35:29 UTC (rev 100060)
+++ contrib/portfile-gen/portfile-gen	2012-11-25 19:05:46 UTC (rev 100061)
@@ -13,15 +13,15 @@
 set supportedGroups [list perl5 python ruby]
 
 
-proc printUsage {} {
-   puts "Usage: $::argv0 \[-h\] \[-g portgroup\] <portname> <portversion>"
-   puts "   -g   Specify a port group to use (perl5, python, etc)"
-   puts "   -h   This help"
-   puts ""
-   puts "portname      name to use for the port; for group-based ports, don't"
-   puts "              use the prefix (py-, p5-, etc) as this will add that"
-   puts "              for you when needed"
-   puts "portversion   version to use for the port"
+proc printUsage {{channel stderr}} {
+   puts $channel "Usage: $::argv0 \[-h\] \[-g portgroup\] <portname> <portversion>"
+   puts $channel "   -g   Specify a port group to use (perl5, python, etc)"
+   puts $channel "   -h   This help"
+   puts $channel ""
+   puts $channel "portname      name to use for the port; for group-based ports, don't"
+   puts $channel "              use the prefix (py-, p5-, etc) as this will add that"
+   puts $channel "              for you when needed"
+   puts $channel "portversion   version to use for the port"
 }
 
 
@@ -30,7 +30,7 @@
    switch [string range [lindex $::argv 0] 1 end] {
       g {
          if {[llength $::argv] < 2} {
-            puts "-g needs a port group"
+            puts stderr "-g needs a port group"
             printUsage
             exit 1
          }
@@ -43,11 +43,11 @@
          set ::argv [lrange $::argv 1 end]
       }
       h {
-         printUsage
+         printUsage stdout
          exit 0
       }
       default {
-         puts "Unknown option [lindex $::argv 0]"
+         puts stderr "Unknown option [lindex $::argv 0]"
          printUsage
          exit 1
       }
@@ -56,7 +56,7 @@
 }
 
 if {[llength $::argv] != 2} {
-   puts "Error: missing portname or portversion"
+   puts stderr "Error: missing portname or portversion"
    printUsage
    exit 1
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20121125/c6763505/attachment.html>


More information about the macports-changes mailing list