From bd9ddc5a7ef95a125fda7ed88be31ad087c1fa51 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Tue, 29 Sep 2015 13:26:37 +0200 Subject: [PATCH 1/2] bash init file: add comment --- Bootstrap/Pmodules/bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Bootstrap/Pmodules/bash b/Bootstrap/Pmodules/bash index 0683631..32f5ad3 100644 --- a/Bootstrap/Pmodules/bash +++ b/Bootstrap/Pmodules/bash @@ -32,6 +32,8 @@ module() { [[ ${#args[@]} == 0 ]] && args+=( 'help' ) [[ ${#args[@]} == 1 ]] && args+=( '--' ) + # we have to eval here, otherwise we cannot do something like + # $ module load gcc/5.2.0 openmpi/1.8.8 hdf5/1.8.15 local -i i=1 for (( i=1; i < ${#args[@]}; i++ )); do eval $( "${modulecmd}" bash "${args[0]}" "${switches[@]}" "${args[i]}" ) From 031c6dd5747405eeb9ed0885c11e3dc3e28979af Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Tue, 29 Sep 2015 13:47:42 +0200 Subject: [PATCH 2/2] Pmodules/modulecmd.bash.in - handle options --help, --version in subcomand_help() --- Bootstrap/Pmodules/modulecmd.bash.in | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Bootstrap/Pmodules/modulecmd.bash.in b/Bootstrap/Pmodules/modulecmd.bash.in index 0b66b7e..4f5e6c6 100755 --- a/Bootstrap/Pmodules/modulecmd.bash.in +++ b/Bootstrap/Pmodules/modulecmd.bash.in @@ -1485,12 +1485,19 @@ subcommand_search() { # subcommand_help() { local opts='' - opts=$(pmodules::get_options -- '' "$@") || usage + opts=$(pmodules::get_options -o HV\? -l version -l help -- "$@") || usage eval set -- "${opts}" local arg='' while (( $# > 0 )); do case $1 in + -[hH] | -\? | --help ) + usage + ;; + -V | --version ) + print_version + std::die 1 + ;; -- ) : ;;