From ee289e156add92db9950002802fe6299c7f3951f Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Thu, 12 Mar 2015 18:37:39 +0100 Subject: [PATCH] scripts/Bootstrap/Pmodules/modulecmd.in: option '--print-modulefiles' added to search sub-command --- scripts/Bootstrap/Pmodules/modulecmd.in | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/scripts/Bootstrap/Pmodules/modulecmd.in b/scripts/Bootstrap/Pmodules/modulecmd.in index e1e40d8..9901229 100755 --- a/scripts/Bootstrap/Pmodules/modulecmd.in +++ b/scripts/Bootstrap/Pmodules/modulecmd.in @@ -817,6 +817,7 @@ subcommand_search() { local modules=() local with_modules='//' local _print_header='yes' + local _print_modulefiles='no' local use_releases=':' local -r fmt="%-20s %-10s %-12s %-s\n" @@ -869,8 +870,17 @@ subcommand_search() { done done done - sort -k 1,1 -k 4,4 -k 5,5 "${tmpfile}" | awk "${with_modules}" 1>&2 - + if [[ "{_print_modulefiles}" == "no" ]]; then + sort -k 1,1 -k 4,4 -k 5,5 "${tmpfile}" | awk "${with_modules}" 1>&2 + else + while read -a line; do + echo -n "${line[2]}/" + for d in "${line[@]:3}"; do + echo -n "$d/" + done + echo "${line[0]}" + done < <(sort -k 1,1 -k 4,4 -k 5,5 "${tmpfile}" | awk "${with_modules}") + fi rm -f "${tmpfile}" } @@ -880,6 +890,10 @@ subcommand_search() { --no-header ) _print_header='no' ;; + --print-modulefiles ) + _print_modulefiles='yes' + _print_header='no' + ;; --release=* ) _val=${1/--release=} if is_release "${_val}"; then