[24551] trunk/base/src/port/port.tcl
source_changes at macosforge.org
source_changes at macosforge.org
Fri Apr 27 17:48:10 PDT 2007
Revision: 24551
http://trac.macosforge.org/projects/macports/changeset/24551
Author: jberry at macports.org
Date: 2007-04-27 17:48:09 -0700 (Fri, 27 Apr 2007)
Log Message:
-----------
Add two new commands to port, for comment:
* port homepage -- emits the homepage url for the given port
* port gohome -- open the homepage url using /usr/bin/open
Please tell me if these are useful. There's a bit more work to be done (man page, autoconf) to
make this really real.
Modified Paths:
--------------
trunk/base/src/port/port.tcl
Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl 2007-04-27 23:38:23 UTC (rev 24550)
+++ trunk/base/src/port/port.tcl 2007-04-28 00:48:09 UTC (rev 24551)
@@ -1883,19 +1883,20 @@
set status 0
require_portlist portlist
foreachport $portlist {
+ # Verify the portname, getting portinfo to map to a porturl
+ if {[catch {set res [dportsearch $portname no exact]} result]} {
+ global errorInfo
+ ui_debug "$errorInfo"
+ break_softcontinue "search for portname $portname failed: $result" 1 status
+ }
+ if {[llength $res] < 2} {
+ break_softcontinue "Port $portname not found" 1 status
+ }
+ array set portinfo [lindex $res 1]
+
# If we have a url, use that, since it's most specific
# otherwise try to map the portname to a url
if {$porturl == ""} {
- # Verify the portname, getting portinfo to map to a porturl
- if {[catch {set res [dportsearch $portname no exact]} result]} {
- global errorInfo
- ui_debug "$errorInfo"
- break_softcontinue "search for portname $portname failed: $result" 1 status
- }
- if {[llength $res] < 2} {
- break_softcontinue "Port $portname not found" 1 status
- }
- array set portinfo [lindex $res 1]
set porturl $portinfo(porturl)
}
@@ -1967,6 +1968,26 @@
# output the path to the port's portfile
puts $portfile
}
+
+ homepage {
+ set homepage $portinfo(homepage)
+ if { $homepage != "" } {
+ puts $homepage
+ } elseif { [ui_isset ports_verbose] } {
+ puts "(no homepage)"
+ }
+ }
+
+ gohome {
+ set homepage $portinfo(homepage)
+ if { $homepage != "" } {
+ # TODO we should autoconfigure this, and perhaps leave an option for
+ # a different command to visit the homepage
+ system "/usr/bin/open $homepage"
+ } else {
+ puts "(no homepage)"
+ }
+ }
}
} else {
break_softcontinue "Could not read $portfile" 1 status
@@ -2135,6 +2156,8 @@
cd action_portcmds
url action_portcmds
file action_portcmds
+ homepage action_portcmds
+ gohome action_portcmds
depends action_target
fetch action_target
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070427/66d409d1/attachment.html
More information about the macports-changes
mailing list