[45248] users/perry/port_cutleaves/port_cutleaves

perry at macports.org perry at macports.org
Sun Jan 11 17:52:21 PST 2009


Revision: 45248
          http://trac.macports.org/changeset/45248
Author:   perry at macports.org
Date:     2009-01-11 17:52:20 -0800 (Sun, 11 Jan 2009)
Log Message:
-----------
perry/port_cutleaves - Added a new command line option: -t
* As in Bryan's port-rdeps, the -t option enables a user to specify a
  different location for the base MacPorts Tcl file.

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:07:42 UTC (rev 45247)
+++ users/perry/port_cutleaves/port_cutleaves	2009-01-12 01:52:20 UTC (rev 45248)
@@ -3,8 +3,7 @@
 exec /usr/bin/tclsh "$0" "$@"
 # $Id$
 
-catch {source "/Library/Tcl/macports1.0/macports_fastload.tcl"}
-package require macports
+package require cmdline
 
 proc cut_leaves {leaves {processed_leaves {}}} {
     # TODO: Use an array rather than a list.
@@ -32,13 +31,13 @@
         set revision            [lindex $leaf 2]
         set variants            [lindex $leaf 3]
         set is_active           [lindex $leaf 4]
-        set composite_version   "${version}_${revision}${variants}"
+        set composite_version   ${version}_${revision}${variants}
         set leaf                "$name @$composite_version"
 
         if {$is_active == 1} {
-            set status "Active"
+            set status Active
         } else {
-            set status "Inactive"
+            set status Inactive
         }
 
         puts "\[Leaf $current_leaf of $total_leaves] $leaf ($status):"
@@ -86,7 +85,7 @@
 
             gets stdin choice
             if {[regexp {^y} $choice]} {
-                puts ""
+                puts {}
                 return [cut_leaves [leaves] $processed_leaves]
             } else {
                 return 0
@@ -133,6 +132,22 @@
     return $uninstalled
 }
 
+set options {
+    { t.arg /Library/Tcl \
+            "Specify a different location for the base MacPorts Tcl file." }
+}
+if {[catch {array set parameters [::cmdline::getoptions argv $options]}]} {
+    puts [::cmdline::usage $options {}]
+    exit 1
+}
+
+if {[catch {source "$parameters(t)/macports1.0/macports_fastload.tcl"} \
+           result]} {
+    puts stderr "Error: source failed: $result"
+    exit 1
+}
+package require macports
+
 if {[catch {mportinit} result]} {
     puts stderr "Error: mportinit failed: $result"
     exit 1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090111/37d61f64/attachment.html>


More information about the macports-changes mailing list