modulecmd: made get_module_prefix() global

This commit is contained in:
2021-12-13 09:35:15 +01:00
parent 225dd774ef
commit dce6d0058f
+8 -8
View File
@@ -213,6 +213,14 @@ is_modulefile() {
[[ "${shebang:0:8}" == '#%Module' ]] || [[ "${shebang:0:9}" == '#%Pmodule' ]]
}
get_module_prefix() {
local "$1"
local modulefile="$2"
local -r _prefix=$("${modulecmd}" bash show "${modulefile}" 2>&1 | \
${awk} '/_PREFIX |_HOME / {print $3; exit}')
std::upvar $1 "${_prefix}"
}
subcommand_generic0() {
local -r subcommand="$1"
shift
@@ -2267,14 +2275,6 @@ subcommand_search() {
${awk} "${with_modules}")
}
get_module_prefix() {
local "$1"
local modulefile="$2"
local -r _prefix=$("${modulecmd}" bash show "${modulefile}" 2>&1 | \
${awk} '/_PREFIX |_HOME / {print $3; exit}')
std::upvar $1 "${_prefix}"
}
#.....................................................................
#
# search modules