summaryrefslogtreecommitdiff
path: root/share/spack/setup-env.sh
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2014-08-22 11:00:19 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2014-08-22 11:00:19 -0700
commitd87a6525823e0d75b9f6b71fb265ebffb9c060a4 (patch)
tree33987364fa00f29ab77d764c9ea56c25cfe37eab /share/spack/setup-env.sh
parenteb5efed421783dddbc6ebfe4ee7a9a987dfda3a5 (diff)
downloadspack-d87a6525823e0d75b9f6b71fb265ebffb9c060a4.tar.gz
spack-d87a6525823e0d75b9f6b71fb265ebffb9c060a4.tar.bz2
spack-d87a6525823e0d75b9f6b71fb265ebffb9c060a4.tar.xz
spack-d87a6525823e0d75b9f6b71fb265ebffb9c060a4.zip
Add spack cd and spack location commands.
- Better shell support for cd'ing into directories - Fix some csh weirdness with nested aliases.
Diffstat (limited to 'share/spack/setup-env.sh')
-rwxr-xr-xshare/spack/setup-env.sh38
1 files changed, 19 insertions, 19 deletions
diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh
index 9a6090a93b..6f56d4739b 100755
--- a/share/spack/setup-env.sh
+++ b/share/spack/setup-env.sh
@@ -76,7 +76,7 @@ function spack {
# command.
case $_sp_subcommand in
"cd")
- cd $(spack stage --print-build-dir "$@")
+ cd $(spack location "$@")
return
;;
"use"|"unuse"|"load"|"unload")
@@ -87,28 +87,28 @@ function spack {
_sp_spec="$@"
fi
- # Translate the parameter into pieces of a command.
- # _sp_modtype is an arg to spack module find, and
- # _sp_sh_cmd is the equivalent shell command.
- case $_sp_subcommand in
- "use"|"unuse")
- _sp_modtype=dotkit
- _sp_sh_cmd=$_sp_subcommand
- ;;
- "load"|"unload")
- _sp_modtype=tcl
- _sp_sh_cmd="module $_sp_subcommand"
- ;;
- esac
-
# Here the user has run use or unuse with a spec. Find a matching
# spec using 'spack module find', then use the appropriate module
# tool's commands to add/remove the result from the environment.
# If spack module command comes back with an error, do nothing.
- if _sp_full_spec=$(command spack $_sp_flags module find $_sp_modtype $_sp_spec); then
- $_sp_sh_cmd $_sp_module_args $_sp_full_spec
- fi
- return
+ case $_sp_subcommand in
+ "use")
+ if _sp_full_spec=$(command spack $_sp_flags module find dotkit $_sp_spec); then
+ use $_sp_module_args $_sp_full_spec
+ fi ;;
+ "unuse")
+ if _sp_full_spec=$(command spack $_sp_flags module find dotkit $_sp_spec); then
+ unuse $_sp_module_args $_sp_full_spec
+ fi ;;
+ "load")
+ if _sp_full_spec=$(command spack $_sp_flags module find dotkit $_sp_spec); then
+ module load $_sp_module_args $_sp_full_spec
+ fi ;;
+ "unload")
+ if _sp_full_spec=$(command spack $_sp_flags module find dotkit $_sp_spec); then
+ module unload $_sp_module_args $_sp_full_spec
+ fi ;;
+ esac
;;
*)
command spack $_sp_flags $_sp_subcommand $_sp_spec