mirror of
https://github.com/Pmodules/Pmodules.git
synced 2026-06-27 01:53:08 +02:00
modulecmd.bash.in: sub.._avail(): use variable reference not dict
using a variable reference makes it possible to pass an array to get_available_modules() insteas a colon separated string
This commit is contained in:
+12
-11
@@ -1170,26 +1170,27 @@ subcommand_avail() {
|
||||
unset IFS
|
||||
local overlay=''
|
||||
local group=''
|
||||
local -A modulepath_of_group
|
||||
local -a groups=()
|
||||
for dir in "${modulepath[@]}"; do
|
||||
group='other'
|
||||
find_overlay overlay group "${dir}"
|
||||
if [[ ${modulepath_of_group[${group}]} ]]; then
|
||||
modulepath_of_group[${group}]+=:${dir}
|
||||
else
|
||||
modulepath_of_group[${group}]=${dir}
|
||||
groups+=( "${group}" )
|
||||
fi
|
||||
if [[ -v modulepath_${group} ]]; then
|
||||
path+=("${dir}")
|
||||
else
|
||||
typeset -a modulepath_${group}="${dir}"
|
||||
typeset -n path=modulepath_${group}
|
||||
groups+=("${group}")
|
||||
fi
|
||||
done
|
||||
local string
|
||||
for string in "${pattern[@]}"; do
|
||||
local p
|
||||
for p in "${pattern[@]}"; do
|
||||
for group in "${groups[@]}"; do
|
||||
declare -n path=modulepath_${group}
|
||||
get_available_modules \
|
||||
mods \
|
||||
"${string}" \
|
||||
"${p}" \
|
||||
"${opt_use_releases}" \
|
||||
"${modulepath_of_group[${group}]}"
|
||||
"${path[@]}"
|
||||
|
||||
[[ ${#mods[@]} == 0 ]] && continue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user