Ticket #685: portquery-variants.tcl

File portquery-variants.tcl, 845 bytes (added by jcorley1@…, 21 years ago)

query-variants target

Line 
1# portquery-variants.tcl
2
3package provide portquery-variants 1.0
4
5set com.apple.query-variants [target_new com.apple.query-variants query-variants_main]
6target_runtype ${com.apple.query-variants} always
7target_provides ${com.apple.query-variants} query-variants
8target_requires ${com.apple.query-variants} main
9
10proc query-variants_main {args} {
11    global portname
12
13    # search for port
14    set res [dportsearch ^$portname$]
15
16    # an array is better than a list for this imho
17    array set portinfo [lindex $res 1]
18
19    # if this fails the port doesn't have any variants
20    if {[catch {set portvariants $portinfo(variants)} result]} {
21        puts "$portname has no variants"
22        exit 1
23    }
24
25    # print out all the variants
26    for {set i 0} {$i < [llength $portvariants]} {incr i} {
27        puts "[lindex $portvariants $i]"
28    }
29}
30