From 453a9c92a1afeb4bef1cf8f30ca7385b87d843bc Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 15 Nov 2017 16:54:20 +0100 Subject: [PATCH 1/3] Pmodules/modulecmd.bahs.in: - subcommand_use(): export MODULEPATH if adding a group, closes #25 --- Pmodules/modulecmd.bash.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index f4ca8b1..c908b9e 100755 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -1310,8 +1310,6 @@ subcommand_use() { shift done - declare -g PMODULES_USED_GROUPS - pbuild::export_env ${g_shell} PMODULES_USED_GROUPS for dir in "${dirs_to_add[@]}"; do if [[ ${opt_append} == yes ]]; then std::append_path MODULEPATH "${dir}" @@ -1319,6 +1317,8 @@ subcommand_use() { std::prepend_path MODULEPATH "${dir}" fi done + declare -g PMODULES_USED_GROUPS + pbuild::export_env ${g_shell} PMODULES_USED_GROUPS MODULEPATH } local opts='' From f3b1291ef29108b164c8c9dc63f1fbe2d712bf79 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 15 Nov 2017 18:00:52 +0100 Subject: [PATCH 2/3] Pmodules/modulecmd.bash.in: fixing #26 --- Pmodules/modulecmd.bash.in | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index c908b9e..10ec002 100755 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -1930,13 +1930,22 @@ while (( $# > 0 )); do opts+=( "$1" ) ;; * ) - subcommand="$1" if [[ -z "${Subcommands[$1]}" ]]; then std::die 1 "${CMD}: unknown sub-command -- $1" fi + subcommand="$1" shift - opts+=( "$@" ) - shift $# + ;; + esac + shift +done + +while (( $# > 0 )); do + case "$1" in + -- ) + ;; + * ) + opts+=( "$1" ) ;; esac shift From 400c4246cbb7340064ebf7a03840707acdc61ad7 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 15 Nov 2017 18:23:15 +0100 Subject: [PATCH 3/3] Pmodules/modulecmd.bash.in: bug fixed in argument parsing, related to #26 --- Pmodules/modulecmd.bash.in | 1 + 1 file changed, 1 insertion(+) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index 10ec002..7efb202 100755 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -1935,6 +1935,7 @@ while (( $# > 0 )); do fi subcommand="$1" shift + break ;; esac shift