Projects
New Ticket     Wiki     Browse Source     Timeline     Roadmap     Bug Reports     Search

Changeset 24551

Show
Ignore:
Timestamp:
2007-04-27 17:48:09 (19 months ago)
Author:
jberry@…
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.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port/port.tcl

    r23967 r24551  
    18841884        require_portlist portlist 
    18851885        foreachport $portlist { 
     1886                # Verify the portname, getting portinfo to map to a porturl 
     1887                if {[catch {set res [dportsearch $portname no exact]} result]} { 
     1888                        global errorInfo 
     1889                        ui_debug "$errorInfo" 
     1890                        break_softcontinue "search for portname $portname failed: $result" 1 status 
     1891                } 
     1892                if {[llength $res] < 2} { 
     1893                        break_softcontinue "Port $portname not found" 1 status 
     1894                } 
     1895                array set portinfo [lindex $res 1] 
     1896 
    18861897                # If we have a url, use that, since it's most specific 
    18871898                # otherwise try to map the portname to a url 
    18881899                if {$porturl == ""} { 
    1889                         # Verify the portname, getting portinfo to map to a porturl 
    1890                         if {[catch {set res [dportsearch $portname no exact]} result]} { 
    1891                                 global errorInfo 
    1892                                 ui_debug "$errorInfo" 
    1893                                 break_softcontinue "search for portname $portname failed: $result" 1 status 
    1894                         } 
    1895                         if {[llength $res] < 2} { 
    1896                                 break_softcontinue "Port $portname not found" 1 status 
    1897                         } 
    1898                         array set portinfo [lindex $res 1] 
    18991900                        set porturl $portinfo(porturl) 
    19001901                } 
     
    19681969                                        puts $portfile 
    19691970                                } 
     1971 
     1972                                homepage { 
     1973                                        set homepage $portinfo(homepage) 
     1974                                        if { $homepage != "" } { 
     1975                                                puts $homepage 
     1976                                        } elseif { [ui_isset ports_verbose] } { 
     1977                                                puts "(no homepage)" 
     1978                                        } 
     1979                                } 
     1980 
     1981                                gohome { 
     1982                                        set homepage $portinfo(homepage) 
     1983                                        if { $homepage != "" } { 
     1984                                                # TODO we should autoconfigure this, and perhaps leave an option for 
     1985                                                # a different command to visit the homepage 
     1986                                                system "/usr/bin/open $homepage" 
     1987                                        } else { 
     1988                                                puts "(no homepage)" 
     1989                                        } 
     1990                                } 
    19701991                        } 
    19711992                } else { 
     
    21362157        url                     action_portcmds 
    21372158        file            action_portcmds 
     2159        homepage        action_portcmds 
     2160        gohome          action_portcmds 
    21382161         
    21392162        depends         action_target