scripts/Bootstrap/Pmodules/modulecmd.in: option '--print-modulefiles' added to search sub-command

This commit is contained in:
2015-03-12 18:37:39 +01:00
parent 6952b1a732
commit ee289e156a

View File

@@ -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