mirror of
https://github.com/Pmodules/Pmodules.git
synced 2026-06-30 03:09:40 +02:00
Merge branch '36-sub-command-unload-must-eval-output-from-modulecmd-bin' into 'master'
Resolve "sub-command unload must eval output from modulecmd.bin" Closes #36 See merge request Pmodules/src!7
This commit is contained in:
+16
-10
@@ -68,21 +68,27 @@ proc module-addgroup { group } {
|
||||
debug "no orphan modules to unload"
|
||||
}
|
||||
debug "mode=remove: $env(MODULEPATH)"
|
||||
remove-path MODULEPATH [file join \
|
||||
$::PmodulesRoot \
|
||||
$group \
|
||||
$::PmodulesModulfilesDir \
|
||||
{*}$::variant]
|
||||
set dir [file join \
|
||||
$::PmodulesRoot \
|
||||
$group \
|
||||
$::PmodulesModulfilesDir \
|
||||
{*}$::variant]
|
||||
debug "mode=remove: dir=$dir"
|
||||
remove-path MODULEPATH $dir
|
||||
debug "mode=remove: $env(UsedGroups)"
|
||||
remove-path UsedGroups $group
|
||||
debug "mode=remove: $env(UsedGroups)"
|
||||
}
|
||||
if { [module-info mode switch2] } {
|
||||
debug "mode=switch2"
|
||||
append-path MODULEPATH [file join \
|
||||
$::PmodulesRoot \
|
||||
$group \
|
||||
$::PmodulesModulfilesDir \
|
||||
[module-info name]]
|
||||
set dir [file join \
|
||||
$::PmodulesRoot \
|
||||
$group \
|
||||
$::PmodulesModulfilesDir \
|
||||
[module-info name]]
|
||||
if { [file isdirectory $dir] } {
|
||||
append-path MODULEPATH $dir
|
||||
}
|
||||
append-path UsedGroups ${group}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -670,8 +670,7 @@ subcommand_load() {
|
||||
current_modulefile="${array[0]}"
|
||||
prefix="${array[1]}"
|
||||
test -n "${current_modulefile}" || return 1
|
||||
get_release release "${current_modulefile}"
|
||||
[[ :${UsedReleases}: =~ ${release} ]]
|
||||
get_release release "${current_modulefile}" "${UsedReleases}"
|
||||
}
|
||||
|
||||
#
|
||||
@@ -865,10 +864,30 @@ subcommand_unload() {
|
||||
# another module.
|
||||
# For the time being the modules requiring this module will be
|
||||
# unloaded too.
|
||||
local opts=()
|
||||
pmodules::get_options opts -- '' "$@" || subcommand_help_${subcommand}
|
||||
eval set -- "${opts[@]}"
|
||||
local args=()
|
||||
while (( $# > 0 )); do
|
||||
subcommand_generic1 unload "$1"
|
||||
case $1 in
|
||||
-- )
|
||||
;;
|
||||
* )
|
||||
args+=( "$1" )
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
if (( ${#args[@]} == 0 )); then
|
||||
std::die 3 "%s %s: missing argument\n" \
|
||||
"${CMD}" 'unload'
|
||||
fi
|
||||
|
||||
for arg in "${args[@]}"; do
|
||||
local output=$("${modulecmd}" "${g_shell}" "${subcommand}" "${arg}")
|
||||
echo "${output}"
|
||||
eval "${output}"
|
||||
done
|
||||
}
|
||||
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user