[45249] users/perry/port_cutleaves/port_cutleaves
perry at macports.org
perry at macports.org
Sun Jan 11 18:11:05 PST 2009
Revision: 45249
http://trac.macports.org/changeset/45249
Author: perry at macports.org
Date: 2009-01-11 18:11:05 -0800 (Sun, 11 Jan 2009)
Log Message:
-----------
perry/port_cutleaves - Added a new command line option: -V
Modified Paths:
--------------
users/perry/port_cutleaves/port_cutleaves
Modified: users/perry/port_cutleaves/port_cutleaves
===================================================================
--- users/perry/port_cutleaves/port_cutleaves 2009-01-12 01:52:20 UTC (rev 45248)
+++ users/perry/port_cutleaves/port_cutleaves 2009-01-12 02:11:05 UTC (rev 45249)
@@ -5,6 +5,8 @@
package require cmdline
+set VERSION 0.1
+
proc cut_leaves {leaves {processed_leaves {}}} {
# TODO: Use an array rather than a list.
foreach leaf [lrange $leaves 0 end] {
@@ -134,7 +136,8 @@
set options {
{ t.arg /Library/Tcl \
- "Specify a different location for the base MacPorts Tcl file." }
+ "Specify a different location for the base MacPorts Tcl file" }
+ { V "Display version information and exit" }
}
if {[catch {array set parameters [::cmdline::getoptions argv $options]}]} {
puts [::cmdline::usage $options {}]
@@ -148,8 +151,12 @@
}
package require macports
-if {[catch {mportinit} result]} {
+if {$parameters(V) == 1} {
+ puts port_cutleaves-$VERSION
+ exit 0
+} elseif {[catch {mportinit} result]} {
puts stderr "Error: mportinit failed: $result"
exit 1
+} else {
+ exit [cut_leaves [leaves]]
}
-exit [cut_leaves [leaves]]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090111/70996b68/attachment.html>
More information about the macports-changes
mailing list