Merge branch 'develop' into features/shared
This commit is contained in:
@@ -66,7 +66,7 @@ case cd:
|
||||
[ $#_sp_args -gt 0 ] && set _sp_arg = ($_sp_args[1])
|
||||
shift _sp_args
|
||||
|
||||
if ( "$_sp_arg" == "-h" ) then
|
||||
if ( "$_sp_arg" == "-h" || "$_sp_args" == "--help" ) then
|
||||
\spack cd -h
|
||||
else
|
||||
cd `\spack location $_sp_arg $_sp_args`
|
||||
@@ -78,7 +78,7 @@ case env:
|
||||
set _sp_arg=""
|
||||
[ $#_sp_args -gt 0 ] && set _sp_arg = ($_sp_args[1])
|
||||
|
||||
if ( "$_sp_arg" == "-h" ) then
|
||||
if ( "$_sp_arg" == "-h" || "$_sp_arg" == "--help" ) then
|
||||
\spack env -h
|
||||
else
|
||||
switch ($_sp_arg)
|
||||
@@ -86,12 +86,18 @@ case env:
|
||||
set _sp_env_arg=""
|
||||
[ $#_sp_args -gt 1 ] && set _sp_env_arg = ($_sp_args[2])
|
||||
|
||||
if ( "$_sp_env_arg" == "" || "$_sp_args" =~ "*--sh*" || "$_sp_args" =~ "*--csh*" || "$_sp_args" =~ "*-h*" ) then
|
||||
# no args or args contain -h/--help, --sh, or --csh: just execute
|
||||
# Space needed here to differentiate between `-h`
|
||||
# argument and environments with "-h" in the name.
|
||||
if ( "$_sp_env_arg" == "" || \
|
||||
"$_sp_args" =~ "* --sh*" || \
|
||||
"$_sp_args" =~ "* --csh*" || \
|
||||
"$_sp_args" =~ "* -h*" || \
|
||||
"$_sp_args" =~ "* --help*" ) then
|
||||
# No args or args contain --sh, --csh, or -h/--help: just execute.
|
||||
\spack $_sp_flags env $_sp_args
|
||||
else
|
||||
shift _sp_args # consume 'activate' or 'deactivate'
|
||||
# actual call to activate: source the output
|
||||
# Actual call to activate: source the output.
|
||||
eval `\spack $_sp_flags env activate --csh $_sp_args`
|
||||
endif
|
||||
breaksw
|
||||
@@ -99,30 +105,40 @@ case env:
|
||||
set _sp_env_arg=""
|
||||
[ $#_sp_args -gt 1 ] && set _sp_env_arg = ($_sp_args[2])
|
||||
|
||||
if ( "$_sp_env_arg" != "" ) then
|
||||
# with args: execute the command
|
||||
# Space needed here to differentiate between `--sh`
|
||||
# argument and environments with "--sh" in the name.
|
||||
if ( "$_sp_args" =~ "* --sh*" || \
|
||||
"$_sp_args" =~ "* --csh*" ) then
|
||||
# Args contain --sh or --csh: just execute.
|
||||
\spack $_sp_flags env $_sp_args
|
||||
else if ( "$_sp_env_arg" != "" ) then
|
||||
# Any other arguments are an error or -h/--help: just run help.
|
||||
\spack $_sp_flags env deactivate -h
|
||||
else
|
||||
# no args: source the output
|
||||
# No args: source the output of the command.
|
||||
eval `\spack $_sp_flags env deactivate --csh`
|
||||
endif
|
||||
breaksw
|
||||
default:
|
||||
echo default
|
||||
\spack $_sp_flags env $_sp_args
|
||||
breaksw
|
||||
endsw
|
||||
endif
|
||||
breaksw
|
||||
|
||||
case load:
|
||||
case unload:
|
||||
# Space in `-h` portion is important for differentiating -h option
|
||||
# from variants that begin with "h" or packages with "-h" in name
|
||||
if ( "$_sp_spec" =~ "*--sh*" || "$_sp_spec" =~ "*--csh*" || \
|
||||
" $_sp_spec" =~ "* -h*" || "$_sp_spec" =~ "*--help*") then
|
||||
# IF a shell is given, print shell output
|
||||
# Get --sh, --csh, -h, or --help arguments.
|
||||
# Space needed here to differentiate between `-h`
|
||||
# argument and specs with "-h" in the name.
|
||||
if ( " $_sp_spec" =~ "* --sh*" || \
|
||||
" $_sp_spec" =~ "* --csh*" || \
|
||||
" $_sp_spec" =~ "* -h*" || \
|
||||
" $_sp_spec" =~ "* --help*") then
|
||||
# Args contain --sh, --csh, or -h/--help: just execute.
|
||||
\spack $_sp_flags $_sp_subcommand $_sp_spec
|
||||
else
|
||||
# otherwise eval with csh
|
||||
# Otherwise, eval with csh.
|
||||
eval `\spack $_sp_flags $_sp_subcommand --csh $_sp_spec || \
|
||||
echo "exit 1"`
|
||||
endif
|
||||
|
||||
@@ -115,31 +115,44 @@ spack() {
|
||||
else
|
||||
case $_sp_arg in
|
||||
activate)
|
||||
_a="$@"
|
||||
# Get --sh, --csh, or -h/--help arguments.
|
||||
# Space needed here becauses regexes start with a space
|
||||
# and `-h` may be the only argument.
|
||||
_a=" $@"
|
||||
# Space needed here to differentiate between `-h`
|
||||
# argument and environments with "-h" in the name.
|
||||
# Also see: https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html#Shell-Parameter-Expansion
|
||||
if [ -z ${1+x} ] || \
|
||||
[ "${_a#*--sh}" != "$_a" ] || \
|
||||
[ "${_a#*--csh}" != "$_a" ] || \
|
||||
[ "${_a#*-h}" != "$_a" ];
|
||||
[ "${_a#* --sh}" != "$_a" ] || \
|
||||
[ "${_a#* --csh}" != "$_a" ] || \
|
||||
[ "${_a#* -h}" != "$_a" ] || \
|
||||
[ "${_a#* --help}" != "$_a" ];
|
||||
then
|
||||
# no args or args contain -h/--help, --sh, or --csh: just execute
|
||||
# No args or args contain --sh, --csh, or -h/--help: just execute.
|
||||
command spack env activate "$@"
|
||||
else
|
||||
# actual call to activate: source the output
|
||||
# Actual call to activate: source the output.
|
||||
eval $(command spack $_sp_flags env activate --sh "$@")
|
||||
fi
|
||||
;;
|
||||
deactivate)
|
||||
_a="$@"
|
||||
if [ "${_a#*--sh}" != "$_a" ] || \
|
||||
[ "${_a#*--csh}" != "$_a" ];
|
||||
# Get --sh, --csh, or -h/--help arguments.
|
||||
# Space needed here becauses regexes start with a space
|
||||
# and `-h` may be the only argument.
|
||||
_a=" $@"
|
||||
# Space needed here to differentiate between `--sh`
|
||||
# argument and environments with "--sh" in the name.
|
||||
# Also see: https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html#Shell-Parameter-Expansion
|
||||
if [ "${_a#* --sh}" != "$_a" ] || \
|
||||
[ "${_a#* --csh}" != "$_a" ];
|
||||
then
|
||||
# just execute the command if --sh or --csh are provided
|
||||
# Args contain --sh or --csh: just execute.
|
||||
command spack env deactivate "$@"
|
||||
elif [ -n "$*" ]; then
|
||||
# any other arguments are an error or help, so just run help
|
||||
# Any other arguments are an error or -h/--help: just run help.
|
||||
command spack env deactivate -h
|
||||
else
|
||||
# no args: source the output of the command
|
||||
# No args: source the output of the command.
|
||||
eval $(command spack $_sp_flags env deactivate --sh)
|
||||
fi
|
||||
;;
|
||||
@@ -151,17 +164,19 @@ spack() {
|
||||
return
|
||||
;;
|
||||
"load"|"unload")
|
||||
# get --sh, --csh, --help, or -h arguments
|
||||
# space is important for -h case to differentiate between `-h`
|
||||
# argument and specs with "-h" in package name or variant settings
|
||||
# Get --sh, --csh, -h, or --help arguments.
|
||||
# Space needed here becauses regexes start with a space
|
||||
# and `-h` may be the only argument.
|
||||
_a=" $@"
|
||||
# Space needed here to differentiate between `-h`
|
||||
# argument and specs with "-h" in the name.
|
||||
# Also see: https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html#Shell-Parameter-Expansion
|
||||
if [ "${_a#* --sh}" != "$_a" ] || \
|
||||
[ "${_a#* --csh}" != "$_a" ] || \
|
||||
[ "${_a#* -h}" != "$_a" ] || \
|
||||
[ "${_a#* --help}" != "$_a" ];
|
||||
then
|
||||
# just execute the command if --sh or --csh are provided
|
||||
# or if the -h or --help arguments are provided
|
||||
# Args contain --sh, --csh, or -h/--help: just execute.
|
||||
command spack $_sp_flags $_sp_subcommand "$@"
|
||||
else
|
||||
eval $(command spack $_sp_flags $_sp_subcommand --sh "$@" || \
|
||||
|
||||
@@ -655,7 +655,7 @@ _spack_debug() {
|
||||
then
|
||||
SPACK_COMPREPLY="-h --help"
|
||||
else
|
||||
SPACK_COMPREPLY="create-db-tarball"
|
||||
SPACK_COMPREPLY="create-db-tarball report"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -663,6 +663,10 @@ _spack_debug_create_db_tarball() {
|
||||
SPACK_COMPREPLY="-h --help"
|
||||
}
|
||||
|
||||
_spack_debug_report() {
|
||||
SPACK_COMPREPLY="-h --help"
|
||||
}
|
||||
|
||||
_spack_dependencies() {
|
||||
if $list_options
|
||||
then
|
||||
@@ -980,7 +984,7 @@ _spack_list() {
|
||||
_spack_load() {
|
||||
if $list_options
|
||||
then
|
||||
SPACK_COMPREPLY="-h --help -r --dependencies --sh --csh --only"
|
||||
SPACK_COMPREPLY="-h --help -r --dependencies --sh --csh --first --only"
|
||||
else
|
||||
_installed_packages
|
||||
fi
|
||||
@@ -1272,7 +1276,7 @@ _spack_pydoc() {
|
||||
_spack_python() {
|
||||
if $list_options
|
||||
then
|
||||
SPACK_COMPREPLY="-h --help -c -m"
|
||||
SPACK_COMPREPLY="-h --help -V --version -c -m"
|
||||
else
|
||||
SPACK_COMPREPLY=""
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user