modulecmd: using/unusing group/modulepath fixed

using a group must have precedence over a directory containing
modulefiles. Otherwise something like `module load Tools` doesn't
work as expected if Tools is a subdirectory of the current
working directory.
This commit is contained in:
2023-06-21 13:54:46 +02:00
parent 8499ea6e95
commit 2fbebfdf98
+6 -6
View File
@@ -1577,11 +1577,6 @@ subcommand_use() {
use_overlay "${arg}"
return $?
fi
if [[ -d ${arg} ]]; then
local dir=$(cd "${arg}" && pwd -L)
${add2path_func} MODULEPATH "${dir}"
return $?
fi
if [[ ! -v GroupDepths[${arg}] ]]; then
# this scan is required if a new group has been
# create inside an used overlay
@@ -1592,6 +1587,11 @@ subcommand_use() {
use_group "${arg}"
return $?
fi
if [[ -d ${arg} ]]; then
local dir=$(cd "${arg}" && pwd -L)
${add2path_func} MODULEPATH "${dir}"
return $?
fi
die_invalid_value "use flag, group, overlay or directory" \
"${arg}"
} # use ()
@@ -1745,7 +1745,7 @@ subcommand_unuse() {
return 0
fi
if [[ -d ${arg} ]]; then
local dir=$(cd "${arg} && pwd -L")
local dir=$(std::get_abspath "${arg}")
std::remove_path MODULEPATH "${dir}"
fi
if [[ -n ${GroupDepths[${arg}]} ]]; then