Ticket #36179: port.diff

File port.diff, 2.6 KB (added by devshashwatpandey@…, 11 years ago)
  • port.tcl

    old new  
    25032503
    25042504proc action_select { action portlist opts } {
    25052505    ui_debug "action_select \[$portlist] \[$opts]..."
    2506 
    2507     # Error out if no group is specified.
    2508     if {[llength $portlist] < 1} {
    2509         ui_error "port select \[--list|--set|--show] <group> \[<version>]"
    2510         return 1
    2511     }
    2512     set group [lindex $portlist 0]
     2506       
     2507        set group [lindex $portlist 0]
    25132508
    25142509    array set opts_array $opts
    25152510    set commands [array names opts_array ports_select_*]
    25162511    array unset opts_array
     2512       
     2513        # Error out if no group is specified or command is not --summary.
     2514    if {[llength $portlist] < 1 && [string map {ports_select_ ""} [lindex $commands 0]] != "summary"} {
     2515        ui_error "port select \[--list|--set|--show|--summary] \<group> \[<version>]"
     2516        return 1
     2517    }
     2518   
    25172519    # If no command (--set, --show, --list) is specified *but* more than one
    25182520    # argument is specified, default to the set command.
    25192521    if {[llength $commands] < 1 && [llength $portlist] > 1} {
     
    26012603                         "'$selected_version'."]
    26022604            return 0
    26032605        }
     2606        summary {
     2607                if {[llength $portlist] > 0} {
     2608                ui_warn [concat "The 'summary' command does not expect any " \
     2609                                "arguments. Extra arguments will be ignored."]
     2610            }
     2611
     2612            if {[catch {mportselect $command} portgroups]} {
     2613                ui_error "The 'summary' command failed: $portgroups"
     2614                return 1
     2615            }
     2616            puts "Portgroups\tOptions"
     2617            foreach pg $portgroups {
     2618                ui_notice $pg
     2619                if {[catch {mportselect list $pg} versions]} {
     2620                ui_error "The list of versions could not be obtained: $versions"
     2621                return 1
     2622                }
     2623                foreach v $versions {
     2624                ui_notice -nonewline "\t"
     2625                if {[{mportselect show $pg} selected_version] == $v} {
     2626                    ui_msg "$v (active)"
     2627                } else {
     2628                    ui_msg "$v"
     2629                }
     2630            }
     2631            return 0
     2632                }
     2633        }
    26042634        default {
    26052635            ui_error "An unknown command '$command' was specified."
    26062636            return 1
     
    42944325    clean       {all archive dist work logs}
    42954326    mirror      {new}
    42964327    lint        {nitpick}
    4297     select      {list set show}
     4328    select      {list set show summary}
    42984329    log         {{phase 1} {level 1}}
    42994330    upgrade     {force enforce-variants no-replace no-rev-upgrade}
    43004331    rev-upgrade {id-loadcmd-check}