modulecmd: fix output of module avail

- for directories outside the hierarchy the header did not include the
  directory name.
This commit is contained in:
2021-09-17 15:32:56 +02:00
parent 06406e463d
commit 50c9b6d692
+6 -2
View File
@@ -1042,8 +1042,12 @@ subcommand_avail() {
local string
for string in "${pattern[@]}"; do
for dir in "${modulepath[@]}"; do
local group="${dir/${PMODULES_ROOT}\/}"
group="${group%%/*}"
if [[ ${dir} =~ ${PMODULES_ROOT} ]]; then
local group="${dir/${PMODULES_ROOT}\/}"
group="${group%%/*}"
else
local group="${dir}"
fi
if (( ${#opt_groups[@]} > 0 )) && [[ ! -v opt_groups[${group}] ]]; then
continue
fi