<pre style='margin:0'>
Kurt Hindenburg (kurthindenburg) pushed a commit to branch master
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/e115b59055a4e5ef7c669990cf86dd39be7ab9b3">https://github.com/macports/macports-base/commit/e115b59055a4e5ef7c669990cf86dd39be7ab9b3</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new e115b59 port-info: output fields in the order given on the command line (#103)
</span>e115b59 is described below
<span style='display:block; white-space:pre;color:#808000;'>commit e115b59055a4e5ef7c669990cf86dd39be7ab9b3
</span>Author: Kurt Hindenburg <kurt.hindenburg@gmail.com>
AuthorDate: Sat Apr 20 13:37:58 2019 -0400
<span style='display:block; white-space:pre;color:#404040;'> port-info: output fields in the order given on the command line (#103)
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> * port-info: output fields in the order given on the command line
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Currently due to the use of 'array names', the output of
</span><span style='display:block; white-space:pre;color:#404040;'> 'port info --multiple-fields' are displayed in a random order.
</span><span style='display:block; white-space:pre;color:#404040;'> Now, the fields are kept in a list which preserves their order they
</span><span style='display:block; white-space:pre;color:#404040;'> were given on the command line.
</span><span style='display:block; white-space:pre;color:#404040;'> This has the effect of also allowing duplicate fields to be displayed.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Also, the order of arguments given on the command line are available
</span><span style='display:block; white-space:pre;color:#404040;'> for any action (not just info).
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Closes: https://trac.macports.org/ticket/57003
</span>---
src/port/port.tcl | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/port/port.tcl b/src/port/port.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index a6c081b..9da4450 100755
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/port/port.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/port/port.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -1912,7 +1912,8 @@ proc action_log { action portlist opts } {
</span>
proc action_info { action portlist opts } {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- global global_variations
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ global global_options global_variations
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> set status 0
if {[require_portlist portlist]} {
return 1
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -2094,7 +2095,20 @@ proc action_info { action portlist opts } {
</span>
# Spin through action options, emitting information for any found
set fields {}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set opts_todo [array names options ports_info_*]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # This contains the display fields in random order
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set opts_info [array names options ports_info_*]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # This contains all parameters in order given on command line
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set opts_action $global_options(options_${action}_order)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Get the display fields in order provided on command line
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # ::struct::set intersect does not keep order of items
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set opts_todo {}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach elem $opts_action {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$elem in $opts_info} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend opts_todo $elem
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> set fields_tried {}
if {![llength $opts_todo]} {
set opts_todo {ports_info_heading
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4468,6 +4482,8 @@ proc parse_options { action ui_options_name global_options_name } {
</span> upvar $ui_options_name ui_options
upvar $global_options_name global_options
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ set options_order(${action}) {}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> while {[moreargs]} {
set arg [lookahead]
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4495,6 +4511,7 @@ proc parse_options { action ui_options_name global_options_name } {
</span> set kargc [lindex $kopts 0 1]
if {$kargc == 0} {
set global_options(ports_${action}_${key}) yes
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend options_order(${action}) ports_${action}_${key}
</span> } else {
set args {}
while {[moreargs] && $kargc > 0} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4591,6 +4608,7 @@ proc parse_options { action ui_options_name global_options_name } {
</span>
advance
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ set global_options(options_${action}_order) $options_order(${action})
</span> }
# acquire exclusive registry lock for actions that need it
</pre><pre style='margin:0'>
</pre>