mirror of
https://github.com/Pmodules/Pmodules.git
synced 2026-08-06 03:12:25 +02:00
modulecmd: fixed in sub-cmd avail
- bugfix in loop collecting per group directories in MODULEPATH - use UsedGroups to loop over the groups, this defines a clear oder - in pmodules_init(): prepend groups to UseGroups instead of appending. This fixes an issue in the order the groups were listed.
This commit is contained in:
+10
-11
@@ -1185,27 +1185,26 @@ subcommand_avail() {
|
|||||||
IFS=':'
|
IFS=':'
|
||||||
local -a modulepath=(${MODULEPATH})
|
local -a modulepath=(${MODULEPATH})
|
||||||
unset IFS
|
unset IFS
|
||||||
local overlay=''
|
local dir
|
||||||
local group=''
|
local group=''
|
||||||
local -a groups=()
|
local overlay=''
|
||||||
for dir in "${modulepath[@]}"; do
|
for dir in "${modulepath[@]}"; do
|
||||||
group='other'
|
group='other'
|
||||||
find_overlay overlay group "${dir}"
|
find_overlay overlay group "${dir}"
|
||||||
if [[ -v modulepath_${group} ]]; then
|
if [[ ! -v modulepath_${group} ]]; then
|
||||||
path+=("${dir}")
|
typeset -a modulepath_${group}
|
||||||
else
|
|
||||||
typeset -a modulepath_${group}="${dir}"
|
|
||||||
typeset -n path=modulepath_${group}
|
|
||||||
groups+=("${group}")
|
|
||||||
fi
|
fi
|
||||||
|
typeset -n path=modulepath_${group}
|
||||||
|
path+=("${dir}")
|
||||||
done
|
done
|
||||||
local p
|
local p
|
||||||
for p in "${pattern[@]}"; do
|
for p in "${pattern[@]}"; do
|
||||||
for group in "${groups[@]}"; do
|
for group in ${UsedGroups//:/ } other; do
|
||||||
if (( ${#opt_groups[@]} > 0 )) && [[ ! -v opt_groups[${group}] ]]; then
|
if (( ${#opt_groups[@]} > 0 )) && [[ ! -v opt_groups[${group}] ]]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
declare -n path=modulepath_${group}
|
[[ -v modulepath_${group} ]] || continue
|
||||||
|
typeset -n path=modulepath_${group}
|
||||||
get_available_modules \
|
get_available_modules \
|
||||||
mods \
|
mods \
|
||||||
"${p}" \
|
"${p}" \
|
||||||
@@ -1807,7 +1806,7 @@ pmodules_init() {
|
|||||||
UsedGroups=''
|
UsedGroups=''
|
||||||
local group
|
local group
|
||||||
for group in ${PMODULES_DEFAULT_GROUPS}; do
|
for group in ${PMODULES_DEFAULT_GROUPS}; do
|
||||||
std::append_path UsedGroups "${group}"
|
std::prepend_path UsedGroups "${group}"
|
||||||
done
|
done
|
||||||
g_env_must_be_saved='yes'
|
g_env_must_be_saved='yes'
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user