[33553] trunk/base/src/port

jkh at macports.org jkh at macports.org
Tue Jan 29 20:09:27 PST 2008


Revision: 33553
          http://trac.macosforge.org/projects/macports/changeset/33553
Author:   jkh at macports.org
Date:     2008-01-29 20:09:26 -0800 (Tue, 29 Jan 2008)

Log Message:
-----------
First cut at a small enhancement to port(1) to have sub-topics for help.

Modified Paths:
--------------
    trunk/base/src/port/Makefile
    trunk/base/src/port/port.tcl

Added Paths:
-----------
    trunk/base/src/port/port-help.tcl

Modified: trunk/base/src/port/Makefile
===================================================================
--- trunk/base/src/port/Makefile	2008-01-30 03:33:34 UTC (rev 33552)
+++ trunk/base/src/port/Makefile	2008-01-30 04:09:26 UTC (rev 33553)
@@ -31,5 +31,7 @@
 
 install: port portindex portmirror mkdirs
 	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}/bin
+	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}/var/macports
 	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 555 port portindex portmirror ${INSTALLDIR}/bin/
+	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 port-help.tcl  ${INSTALLDIR}/var/macports/
 	cd ${INSTALLDIR}/bin && $(LN_S) -f port portf

Added: trunk/base/src/port/port-help.tcl
===================================================================
--- trunk/base/src/port/port-help.tcl	                        (rev 0)
+++ trunk/base/src/port/port-help.tcl	2008-01-30 04:09:26 UTC (rev 33553)
@@ -0,0 +1,69 @@
+# This file contains help strings for the various commands/topics in port(1)
+#
+# Many of these strings are place-holders right now.  Replace with genuinely
+# helpful text and then delete this message.
+#
+# port-help.tcl
+# $Id$
+
+set porthelp(activate) "activate a port"
+set porthelp(archive) "archive a port"
+set porthelp(build) "build a port"
+set porthelp(cat) "cat a port"
+set porthelp(cd) "cd to a port"
+set porthelp(checksum) "checksum a port"
+set porthelp(clean) "clean a port"
+set porthelp(compact) "compact a port"
+set porthelp(configure) "configure a port"
+set porthelp(contents) "get contents for a port"
+set porthelp(deactivate) "deactivate a port"
+set porthelp(dependents) "dependents a port"
+set porthelp(deps) "show deps for a port"
+set porthelp(destroot) "destroot a port"
+set porthelp(dir) "dir a port"
+set porthelp(distcheck) "distcheck a port"
+set porthelp(dmg) "dmg a port"
+set porthelp(dpkg) "dpkg a port"
+set porthelp(echo) "echo a port"
+set porthelp(ed) "ed a port"
+set porthelp(edit) "edit a port"
+set porthelp(exit) "exit a port"
+set porthelp(extract) "extract a port"
+set porthelp(fetch) "fetch a port"
+set porthelp(file) "file a port"
+set porthelp(gohome) "gohome a port"
+set porthelp(help) "help a port"
+set porthelp(info) "info a port"
+set porthelp(install) "install a port"
+set porthelp(installed) "installed a port"
+set porthelp(lint) "lint a port"
+set porthelp(list) "list a port"
+set porthelp(livecheck) "livecheck a port"
+set porthelp(load) "load a port"
+set porthelp(location) "location a port"
+set porthelp(mdmg) "mdmg a port"
+set porthelp(mirror) "mirror a port"
+set porthelp(mpkg) "mpkg a port"
+set porthelp(outdated) "outdated a port"
+set porthelp(patch) "patch a port"
+set porthelp(pkg) "pkg a port"
+set porthelp(platform) "platform a port"
+set porthelp(provides) "provides a port"
+set porthelp(quit) "quit a port"
+set porthelp(rpm) "rpm a port"
+set porthelp(search) "search a port"
+set porthelp(selfupdate) "selfupdate a port"
+set porthelp(srpm) "srpm a port"
+set porthelp(submit) "submit a port"
+set porthelp(sync) "sync a port"
+set porthelp(test) "test a port"
+set porthelp(trace) "trace a port"
+set porthelp(unarchive) "unarchive a port"
+set porthelp(uncompact) "uncompact a port"
+set porthelp(uninstall) "uninstall a port"
+set porthelp(unload) "unload a port"
+set porthelp(upgrade) "upgrade a port"
+set porthelp(url) "url a port"
+set porthelp(usage) "usage a port"
+set porthelp(variants) "variants a port"
+set porthelp(version) "version a port"

Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl	2008-01-30 03:33:34 UTC (rev 33552)
+++ trunk/base/src/port/port.tcl	2008-01-30 04:09:26 UTC (rev 33553)
@@ -1093,7 +1093,32 @@
 
 
 proc action_help { action portlist opts } {
-    print_help
+    set pl [lindex $portlist 0]
+    set x [lsearch $pl name*]
+    set helpfile "$macports::prefix/var/macports/port-help.tcl"
+
+    if {$x != -1} {
+	set topic [lindex $pl [expr $x + 1]]
+	if {[file exists $helpfile]} {
+		if {[catch {source $helpfile} err]} {
+			puts "Error reading helpfile $helpfile: $err"
+			return 1
+		} else {
+			if {[info exists porthelp($topic)]} {
+				puts $porthelp($topic)
+				return 0
+			} else {
+				puts "No help for topic $topic"
+				return 1
+			}
+		}
+	} else {
+		puts "Unable to open help file $helpfile"
+		return 1
+	}
+    } else {
+    	print_help
+    }
     return 0
 }
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080129/e2324b7b/attachment.html


More information about the macports-changes mailing list