From 9c304009c315ff6863458d1b8716301daaadfc37 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 18 May 2022 10:24:21 +0200 Subject: [PATCH] module use: output of overlay info improved --- Pmodules/modulecmd.bash.in | 61 +++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index 3ae39ff..aa93c93 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -1352,6 +1352,32 @@ subcommand_use() { #...................................................................... print_info() { + print_ol_info(){ + local only_used="$1" + local ol='' + for ol in "${OverlayList[@]}"; do + [[ ${OverlayDict[${ol}:used]} == ${only_used} ]] || continue + local inst_root="${OverlayDict[${ol}:inst_root]}" + local mod_root="${OverlayDict[${ol}:mod_root]}" + local txt="\t${ol}" + if [[ ${inst_root} == ${mod_root} ]]; then + txt+="\n\t\t${inst_root}" + else + txt+="\n\t\t${inst_root} (install root)" + txt+="\n\t\t${mod_root} (modulefiles root)" + fi + case "${OverlayDict[${ol}:type]}" in + "${ol_hiding}" ) + txt+='\n\t\t(hiding modules with same name)' + ;; + "${ol_replacing}" ) + txt+='\n\t\t(replacing groups)' + ;; + esac + std::info "${txt}" + done + } + local f local r std::info "Used groups:" @@ -1384,42 +1410,11 @@ subcommand_use() { std::info '' std::info "Used overlays:" - - local ol='' - for ol in "${OverlayList[@]}"; do - local txt="${OverlayDict[${ol}:inst_root]}" - if [[ ${OverlayDict[${ol}:inst_root]} != ${OverlayDict[${ol}:mod_root]} ]]; then - txt+="|${OverlayDict[${ol}:mod_root]}" - fi - case "${OverlayDict[${ol}:type]}" in - "${ol_hiding}" ) - txt+=' (hiding modules with same name)' - ;; - "${ol_replacing}" ) - txt+=' (replacing groups)' - ;; - esac - std::info "\t${ol}: ${txt}" - done + print_ol_info 'yes' std::info '' std::info "Unused overlays:" - for ol in "${Overlays[@]}"; do - [[ ${OverlayDict[${ol}:used]} == 'yes' ]] && continue - local txt="${OverlayDict[${ol}:inst_root]}" - if [[ ${OverlayDict[${ol}:inst_root]} != ${OverlayDict[${ol}:mod_root]} ]]; then - txt+="|${OverlayDict[${ol}:mod_root]}" - fi - case "${OverlayDict[${ol}:type]}" in - "${ol_hiding}" ) - txt+=' (hiding modules with same name)' - ;; - "${ol_replacing}" ) - txt+=' (replacing groups)' - ;; - esac - std::info "\t${ol}: ${txt}" - done + print_ol_info 'no' std::info '' std::info "Additonal directories in MODULEPATH:"