diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2014-08-22 11:00:19 -0700 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2014-08-22 11:00:19 -0700 |
commit | d87a6525823e0d75b9f6b71fb265ebffb9c060a4 (patch) | |
tree | 33987364fa00f29ab77d764c9ea56c25cfe37eab /share/spack/csh | |
parent | eb5efed421783dddbc6ebfe4ee7a9a987dfda3a5 (diff) | |
download | spack-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/csh')
-rw-r--r-- | share/spack/csh/pathadd.csh (renamed from share/spack/csh/spack_pathadd.csh) | 0 | ||||
-rw-r--r-- | share/spack/csh/spack.csh | 50 |
2 files changed, 28 insertions, 22 deletions
diff --git a/share/spack/csh/spack_pathadd.csh b/share/spack/csh/pathadd.csh index 1e0800c5f3..1e0800c5f3 100644 --- a/share/spack/csh/spack_pathadd.csh +++ b/share/spack/csh/pathadd.csh diff --git a/share/spack/csh/spack.csh b/share/spack/csh/spack.csh index 6073673333..30c4ec1361 100644 --- a/share/spack/csh/spack.csh +++ b/share/spack/csh/spack.csh @@ -45,9 +45,9 @@ set _sp_spec="" # Figure out what type of module we're running here. set _sp_modtype = "" switch ($_sp_subcommand) -case "cd": +case cd: shift _sp_args - cd `spack stage --print-build-dir $_sp_args` + cd `spack location $_sp_args` breaksw case use: case unuse: @@ -59,30 +59,36 @@ case unload: shift _sp_spec set _sp_spec = ($_sp_spec) endif - # 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. - switch ($_sp_subcommand) - case use: - case unuse: - set _sp_modtype = dotkit - set _sp_sh_cmd = ( "`alias $_sp_subcommand'" ) - breaksw - case load: - case unload: - set _sp_modtype = tcl - set _sp_sh_cmd = ( "`alias module`" $_sp_subcommand ) - breaksw - endsw # 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. - set _sp_full_spec = "" - if { set _sp_full_spec = `\spack module find $_sp_modtype $_sp_spec` } then - $_sp_sh_cmd $_sp_module_args $_sp_full_spec - endif + switch ($_sp_subcommand) + case "use": + set _sp_full_spec = ( "`\spack $_sp_flags module find dotkit $_sp_spec`" ) + if ( $? == 0 ) then + use $_sp_module_args $_sp_full_spec + endif + breaksw + case "unuse": + set _sp_full_spec = ( "`\spack $_sp_flags module find dotkit $_sp_spec`" ) + if ( $? == 0 ) then + unuse $_sp_module_args $_sp_full_spec + endif + breaksw + case "load": + set _sp_full_spec = ( "`\spack $_sp_flags module find tcl $_sp_spec`" ) + if ( $? == 0 ) then + module load $_sp_module_args $_sp_full_spec + endif + breaksw + case "unload": + set _sp_full_spec = ( "`\spack $_sp_flags module find tcl $_sp_spec`" ) + if ( $? == 0 ) then + module unload $_sp_module_args $_sp_full_spec + endif + breaksw + endsw breaksw default: |