diff --git a/scripts/Bootstrap/Pmodules/modmanage.in b/scripts/Bootstrap/Pmodules/modmanage.in index 3c01f8b..6301e31 100755 --- a/scripts/Bootstrap/Pmodules/modmanage.in +++ b/scripts/Bootstrap/Pmodules/modmanage.in @@ -27,6 +27,9 @@ Switches: Available SubCommands and Args: init [--src=] [--user=] --dst= Initialize a new minimal Pmodule environment. + + install [--with=...] + Install matching modules " } @@ -46,6 +49,13 @@ init [--src=] [--user=] " 1>&2 } +subcommand_help_install() { + echo " +install [--with=...] + Install matching modules +" 1>&2 +} + subcommand_help() { if [[ $# == 0 ]]; then usage @@ -240,6 +250,46 @@ environment at '${PSI_PREFIX}' } +subcommand_install() { + local opts='' + local -a with=() + local -a releases=() + local -a module_pattern=() + + opts=$(get_options -o h -l with: -l release: -l help -- "$@") + if [[ $? != 0 ]]; then + subcommand_help_install + exit 1 + fi + eval set -- "${opts}" + while (($# > 0)); do + case $1 in + --release ) + releases+=( "$2" ) + echo $2 + shift + ;; + --with ) + with+=( "$2" ) + shift + ;; + -- ) + : + ;; + -* | -h | --help ) + echo "$1: illegal option" 1>&2 + subcommand_help_init + exit 1 + ;; + * ) + module_pattern+=( "$1" ) + ;; + esac + shift + done + ${PMODULES_HOME}/bin/modulecmd bash search "${module_pattern[@]}" "${with[@]/#/--with}" "${releases[@]/#/--release=}" --no-header +} + while (($# > 0)); do case $1 in -h | -H | -\? | --help | -help ) @@ -261,7 +311,7 @@ while (($# > 0)); do echo "$1: unknown switch.\n" 1>&2 exit 1 ;; - init|help ) + init|install|help ) subcommand="subcommand_$1" shift sargs=( $* )