Skip to content

Commit fed58aa

Browse files
committed
Add indesym value to avail_{,terse_}output config
Report symbolic versions as independent element on avail sub-command when "indesym" value is part of avail_output/avail_terse_output configuration option. When "indesym" value is set, "sym" and "dirwsym" elements are disabled.
1 parent 8db28ef commit fed58aa

File tree

4 files changed

+30
-9
lines changed

4 files changed

+30
-9
lines changed

.hunspell.en.dic

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,3 +1138,4 @@ foss21a
11381138
othervariant
11391139
bitwise
11401140
modpath
1141+
indesym

tcl/init.tcl.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ array set g_config_defs [list\
7070
auto_handling {MODULES_AUTO_HANDLING @autohandling@ 0 b {0 1}}\
7171
avail_indepth {MODULES_AVAIL_INDEPTH @availindepth@ 0 b {0 1}}\
7272
avail_output {MODULES_AVAIL_OUTPUT {@availoutput@} 0 l {modulepath alias\
73-
dirwsym sym tag key variant variantifspec} {} {} eltlist}\
73+
dirwsym indesym sym tag key variant variantifspec} {} {} eltlist}\
7474
avail_terse_output {MODULES_AVAIL_TERSE_OUTPUT {@availterseoutput@} 0 l\
75-
{modulepath alias dirwsym sym tag key variant variantifspec} {} {}\
76-
eltlist}\
75+
{modulepath alias dirwsym indesym sym tag key variant variantifspec} {}\
76+
{} eltlist}\
7777
cache_buffer_bytes {MODULES_CACHE_BUFFER_BYTES 32768 0 i {4096 1000000} {}\
7878
{} intbe}\
7979
cache_expiry_secs {MODULES_CACHE_EXPIRY_SECS 0 0 i {0 31536000} {} {}\

tcl/modfind.tcl.in

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2894,7 +2894,8 @@ proc getModules {dir {mod {}} {fetch_mtime 0} {search {}} {filter {}}} {
28942894
defineDoesModMatchAtDepthProc $indepth $querydepth $mtest
28952895

28962896
# element to include in output
2897-
set report_dirwsym [isEltInReport dirwsym]
2897+
set report_indesym [isEltInReport indesym 0]
2898+
set report_dirwsym [expr {!$report_indesym && [isEltInReport dirwsym]}]
28982899

28992900
array set mod_list {}
29002901
array set fdir_list {}
@@ -2928,8 +2929,9 @@ proc getModules {dir {mod {}} {fetch_mtime 0} {search {}} {filter {}}} {
29282929
}
29292930

29302931
# version may matches query but not its target, so it should be in
2931-
# this case manually added to result (if it exists)
2932-
if {$elt_type eq {version}} {
2932+
# this case manually added to result (if it exists and unless if
2933+
# versions should be reported independently)
2934+
if {$elt_type eq {version} && !$report_indesym} {
29332935
# resolve eventual icase target
29342936
set versmod [getArrayKey found_list [lindex $mod_list($elt) 1]\
29352937
$icase]

tcl/report.tcl.in

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,7 +1284,11 @@ proc reportModules {search_queries header hsgrkey hstyle show_mtime show_idx\
12841284
}
12851285
12861286
# elements to include in output
1287-
set report_sym [isEltInReport sym]
1287+
if {[set report_indesym [isEltInReport indesym 0]]} {
1288+
set report_sym 0
1289+
} else {
1290+
set report_sym [isEltInReport sym]
1291+
}
12881292
set report_tag [isEltInReport tag]
12891293
set report_alias [isEltInReport alias]
12901294
# enable variant report if variantifspec configured and some variant is
@@ -1387,6 +1391,15 @@ proc reportModules {search_queries header hsgrkey hstyle show_mtime show_idx\
13871391
$himatchmap] disp dispsgr displen
13881392
}
13891393
}
1394+
version {
1395+
# report symbolic version independently from the module it is
1396+
# attached to. only done on regular or terse output when 'indesym'
1397+
# element is in relative output configuration option
1398+
if {$report_indesym} {
1399+
lassign [formatListEltToDisplay $elt sy {} {} {} 0 0 {} 0 {}\
1400+
{} 0 $himatchmap] disp dispsgr displen
1401+
}
1402+
}
13901403
}
13911404
if {$dispsgr ne {}} {
13921405
if {$json} {
@@ -1645,10 +1658,15 @@ proc displayElementList {header sgrkey hstyle one_per_line display_idx\
16451658
# Report an output key to help understand what the SGR used on this output
16461659
# correspond to
16471660
proc displayKey {} {
1661+
# specific key entry for symbolic version if reported independently
1662+
set typesym [list {symbolic-version}]
1663+
if {![isEltInReport indesym 0]} {
1664+
lappend typesym [sgr se (]<SGR>[sgr se )] 18
1665+
}
1666+
16481667
array set skipsgr [list hi 1 db 1 tr 1 se 1 er 1 wa 1 me 1 in 1 cm 1 va 1]
16491668
array set typesgr [list mp modulepath di [list directory <SGR>/ 10] al\
1650-
module-alias sy [list {symbolic-version} [sgr se (]<SGR>[sgr se )] 18]\
1651-
de [list {default-version}]]
1669+
module-alias sy $typesym de [list {default-version}]]
16521670
16531671
set display_list {}
16541672
set len_list {}

0 commit comments

Comments
 (0)