[137289] branches/gsoc15-portfile/port-create.tcl

chunyang at macports.org chunyang at macports.org
Mon Jun 8 08:08:44 PDT 2015


Revision: 137289
          https://trac.macports.org/changeset/137289
Author:   chunyang at macports.org
Date:     2015-06-08 08:08:44 -0700 (Mon, 08 Jun 2015)
Log Message:
-----------
port-create: Trap the error of parsing CLI options manually

Modified Paths:
--------------
    branches/gsoc15-portfile/port-create.tcl

Modified: branches/gsoc15-portfile/port-create.tcl
===================================================================
--- branches/gsoc15-portfile/port-create.tcl	2015-06-08 14:22:24 UTC (rev 137288)
+++ branches/gsoc15-portfile/port-create.tcl	2015-06-08 15:08:44 UTC (rev 137289)
@@ -55,7 +55,10 @@
         {version.arg  ""  "set the version of port"}
     }
     set usage ": $argv0 \[-url <url>] \[-name <name>] \[-version <version>]\noptions:"
-    array set params [::cmdline::getoptions argv $options $usage]
+    if {[catch {array set params [cmdline::getoptions ::argv $options $usage]}]} {
+        puts [cmdline::usage $options $usage]
+        exit 2
+    }
 
     if {[expr {[string length $params(url)] > 0}]} {
         set tarball [get_tarball_filename $params(url)]
@@ -72,7 +75,13 @@
     }
 
     set template [read_template "./Portfile.template"]
-    set template [string map "__PortName__ $name" $template]
-    set template [string map "__PortVersion__ $version" $template]
+
+    if {$name ne""} {
+        set template [string map "__PortName__ $name" $template]
+    }
+    if {$version ne ""} {
+        set template [string map "__PortVersion__ $version" $template]
+    }
+
     puts $template
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150608/5f50f549/attachment.html>


More information about the macports-changes mailing list