modulecmd: sort output of sub-command avail numerically

This commit is contained in:
2021-10-29 12:05:41 +02:00
parent f7f589471e
commit 3d326a527a
+2
View File
@@ -972,6 +972,8 @@ subcommand_avail() {
(( n > max_length )) && (( max_length=n ))
available_modules+=("${mod}")
done
IFS=$'\n' available_modules=($(sort --version-sort <<<"${available_modules[*]}"))
unset IFS
local -i span=$(( max_length / 16 + 1 )) # compute column size
local -i colsize=$(( span * 16 )) # as multiple of 16
local -i column=$cols # force a line-break