Skip to content

Commit 93c22f3

Browse files
committed
Sort modules in JSON output as done on regular output
Signed-off-by: Xavier Delaruelle <[email protected]>
1 parent de5052b commit 93c22f3

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

NEWS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ Modules 5.6.0 (not yet released)
138138
* :mfcmd:`setenv` modulefile command now supports environment variable value
139139
containing newline character. Exception is made for *csh* and *tcsh* shells
140140
where newline characters are chopped from value. (fix issue #557)
141+
* Sort modules in JSON output as done on regular output.
141142

142143
.. _Security policy: https://github.com/envmodules/modules/blob/main/SECURITY.md
143144
.. _Modules chat room: https://matrix.to/#/#modules:matrix.org

tcl/report.tcl.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,6 +1579,10 @@ proc reportModules {search_queries header hsgrkey hstyle show_mtime show_idx\
15791579
15801580
set len_list {}
15811581
set max_len 0
1582+
# dictionary-sort results unless if output order is specified
1583+
if {![llength $mod_list_order]} {
1584+
set clean_list [lsort -dictionary $clean_list]
1585+
}
15821586
if {$json} {
15831587
##nagelfar ignore Found constant
15841588
upvar 0 clean_list display_list
@@ -1587,10 +1591,6 @@ proc reportModules {search_queries header hsgrkey hstyle show_mtime show_idx\
15871591
}
15881592
} else {
15891593
set display_list {}
1590-
# dictionary-sort results unless if output order is specified
1591-
if {![llength $mod_list_order]} {
1592-
set clean_list [lsort -dictionary $clean_list]
1593-
}
15941594
foreach disp $clean_list {
15951595
# compute display element length list on sorted result
15961596
lappend display_list $sgrmap($disp)

0 commit comments

Comments
 (0)