Add hide_auto_loaded configuration option

Add hide_auto_loaded configuration option that controls whether auto
loaded modules should be hidden or not (hidden-loaded tag applied).
Disabled by default. When configuration is modified it sets the
MODULES_HIDE_AUTO_LOADED environment variable.
This commit is contained in:
Xavier Delaruelle
2024-04-03 07:50:38 +02:00
parent 9aa5f9d948
commit 545c846511
2 changed files with 9 additions and 0 deletions

View File

@@ -90,6 +90,7 @@ array set g_config_defs [list\
csh_limit {{} 4000 0 i}\
extra_siteconfig {MODULES_SITECONFIG <undef> 1 s {}}\
editor {MODULES_EDITOR {@editor@} 0 s {} {} initConfEditor}\
hide_auto_loaded {MODULES_HIDE_AUTO_LOADED 0 0 b {0 1}}\
home {MODULESHOME {@moduleshome@} 0 s}\
icase {MODULES_ICASE @icase@ 0 s {never search always}}\
ignore_cache {MODULES_IGNORE_CACHE 0 0 b {0 1}}\

View File

@@ -1260,6 +1260,14 @@ proc cmdModuleLoad {context uasked tryload loadany tag_list args} {
}
}
# hide auto loaded modules if hide_auto_loaded config is enabled
if {!$uasked && [getConf hide_auto_loaded]} {
setModuleTag $modname hidden-loaded
if {$modnamevr ne {} && $modname ne $modnamevr} {
setModuleTag $modnamevr hidden-loaded
}
}
if {[execute-modulefile $modfile $modname modnamevr $mod]} {
break
}