[137138] branches/gsoc15-portfile
chunyang at macports.org
chunyang at macports.org
Thu Jun 4 23:43:38 PDT 2015
Revision: 137138
https://trac.macports.org/changeset/137138
Author: chunyang at macports.org
Date: 2015-06-04 23:43:38 -0700 (Thu, 04 Jun 2015)
Log Message:
-----------
port-create: Extract name and version from CLI arguments
Modified Paths:
--------------
branches/gsoc15-portfile/Makefile
branches/gsoc15-portfile/port-create.tcl
branches/gsoc15-portfile/port-create.test
Modified: branches/gsoc15-portfile/Makefile
===================================================================
--- branches/gsoc15-portfile/Makefile 2015-06-05 05:49:11 UTC (rev 137137)
+++ branches/gsoc15-portfile/Makefile 2015-06-05 06:43:38 UTC (rev 137138)
@@ -1,2 +1,2 @@
test: port-create.tcl all.tcl port-create.test
- tclsh all.tcl
+ tclsh8.5 all.tcl
Modified: branches/gsoc15-portfile/port-create.tcl
===================================================================
--- branches/gsoc15-portfile/port-create.tcl 2015-06-05 05:49:11 UTC (rev 137137)
+++ branches/gsoc15-portfile/port-create.tcl 2015-06-05 06:43:38 UTC (rev 137138)
@@ -43,3 +43,16 @@
proc feed_template {template metadata} {
return $template
}
+
+proc parse_cli_argument {argv} {
+ package require cmdline
+ set options {
+ {name.arg "" "set the name of port"}
+ {version.arg "" "set the version of port"}
+ }
+ array set params [::cmdline::getoptions argv $options]
+
+ set name $params(name)
+ set version $params(version)
+ return [list $name $version]
+}
Modified: branches/gsoc15-portfile/port-create.test
===================================================================
--- branches/gsoc15-portfile/port-create.test 2015-06-05 05:49:11 UTC (rev 137137)
+++ branches/gsoc15-portfile/port-create.test 2015-06-05 06:43:38 UTC (rev 137138)
@@ -11,4 +11,8 @@
list [get_name $tarball] [get_version $tarball]
} -result [list git 2.4.2]
+test parse_cli_argument_test {} -body {
+ parse_cli_argument {-name git -version 2.4.2}
+} -result [list git 2.4.2]
+
cleanupTests
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150604/f80d95f5/attachment.html>
More information about the macports-changes
mailing list