diff --git a/modulecmd.tcl.in b/modulecmd.tcl.in index 39705bca..8f7a9620 100644 --- a/modulecmd.tcl.in +++ b/modulecmd.tcl.in @@ -1513,9 +1513,9 @@ proc module {command args} { reportDebug "cmd='$command', args='$args' (mode=$mode)" - # parse listing specific options, do that globally to ignore these - # options on commands not related to listing (exclude them from arg list) - lassign [eval parseListCommandArgs $command $args] show_oneperline\ + # parse options, do that globally to ignore options not related to a given + # module sub-command (exclude them from arg list) + lassign [eval parseModuleCommandArgs $command $args] show_oneperline\ show_mtime show_filter args # guess if called from top level @@ -5602,8 +5602,8 @@ proc readCollectionContent {collfile colldesc} { return [list $path_list $mod_list $nuasked_list] } -# analyze arg list passed to a module cmd to set listing-related options -proc parseListCommandArgs {cmd args} { +# analyze arg list passed to a module cmd to set options +proc parseModuleCommandArgs {cmd args} { set show_oneperline 0 set show_mtime 0 set show_filter "" @@ -5631,6 +5631,9 @@ proc parseListCommandArgs {cmd args} { {-L} - {--latest} { set show_filter "onlylatest" } + {--auto} - {--no-auto} { + reportWarning "Unsupported option '$arg'" + } default { lappend otherargs $arg } diff --git a/testsuite/modulefiles.deps/mu b/testsuite/modulefiles.deps/mu new file mode 100644 index 00000000..5588bbd6 --- /dev/null +++ b/testsuite/modulefiles.deps/mu @@ -0,0 +1,4 @@ +#%Module +module load --auto ms +module switch --auto ms ms +module unload --no-auto ms diff --git a/testsuite/modules.50-cmds/372-deps3.exp b/testsuite/modules.50-cmds/372-deps3.exp index 19f5ee47..09109cc7 100644 --- a/testsuite/modules.50-cmds/372-deps3.exp +++ b/testsuite/modules.50-cmds/372-deps3.exp @@ -43,6 +43,18 @@ setenv_path_var MODULES_LMCONFLICT "c&c" setenv_path_var MODULES_LMPREREQ "b&c" testouterr_cmd "sh" "unload c" "ERR" "$error_msgs: [err_prerequn c b]" +# restore environment +unsetenv_path_var MODULES_LMCONFLICT +unsetenv_path_var MODULES_LMPREREQ +unsetenv_loaded_module + +# check warning raised when using --auto/--no-auto from modulefile +set ans [list] +lappend ans [list setpath LOADEDMODULES "mu"] +lappend ans [list setpath _LMFILES_ "$mp/mu"] +lappend ans [list unsetpath MODULES_LMCONFLICT] +lappend ans [list unsetpath MODULES_LMNOTUASKED] +testouterr_cmd "sh" "load mu" $ans "$warn_msgs: Unsupported option '--auto'\n$warn_msgs: Unsupported option '--auto'\n$warn_msgs: Unsupported option '--no-auto'" # # Cleanup @@ -50,9 +62,6 @@ testouterr_cmd "sh" "unload c" "ERR" "$error_msgs: [err_prerequn c b]" # restore environment setenv_path_var MODULEPATH $modpath -unsetenv_path_var MODULES_LMCONFLICT -unsetenv_path_var MODULES_LMPREREQ -unsetenv_loaded_module unset mp unset ans