summaryrefslogtreecommitdiff
path: root/share/spack/setup-env.sh
diff options
context:
space:
mode:
authorTom Scogland <scogland1@llnl.gov>2020-12-18 17:26:15 -0800
committerGitHub <noreply@github.com>2020-12-18 17:26:15 -0800
commit71c77fa8fa351f7ed94f914175456da5f432bc31 (patch)
tree4071960c79446cb8b7c874210f8fa54988d831c4 /share/spack/setup-env.sh
parent517413c1252304474b1b4629c70e26bbc4b7e1bb (diff)
downloadspack-71c77fa8fa351f7ed94f914175456da5f432bc31.tar.gz
spack-71c77fa8fa351f7ed94f914175456da5f432bc31.tar.bz2
spack-71c77fa8fa351f7ed94f914175456da5f432bc31.tar.xz
spack-71c77fa8fa351f7ed94f914175456da5f432bc31.zip
minimal zsh completion (#20253)
Since zsh can load bash completion files natively, seems reasonable to just turn this on. The only changes are to switch from `type -t` which zsh doesn't support to using `type` with a regex and adding a new arm to the sourcing of the completions to allow it to work for zsh as well as bash. Could use more bash/dash/etc testing probably, but everything I've thought to try has worked so far. Notes: * unit-test zsh support, fix issues Specifically fixed word splitting in completion-test, use a different method to apply sh emulation to zsh loaded bash completion, and fixed an incompatibility in regex operator quoting requirements. * compinit now ignores insecure directories Completion isn't meant to be enabled in non-interactive environments, so by default compinit will ask the user if they want to ignore insecure directories or load them anyway. To pass the spack unit tests in GH actions, this prompt must be disabled, so ignore explicitly until a better solution can be found. * debug functions test also requires bash emulation COMP_WORDS is a bash-ism that zsh doesn't natively support, turn on emulation for just that section of tests to allow the comparison to work. Does not change the behavior of the functions themselves since they are already pinned to sh emulation elsewhere. * propagate change to .in file * fix comment and update script based on .in
Diffstat (limited to 'share/spack/setup-env.sh')
-rwxr-xr-xshare/spack/setup-env.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh
index 5761d16362..7f648207e4 100755
--- a/share/spack/setup-env.sh
+++ b/share/spack/setup-env.sh
@@ -371,7 +371,7 @@ _sp_multi_pathadd MODULEPATH "$_sp_tcl_roots"
# Add programmable tab completion for Bash
#
-if [ "$_sp_shell" = bash ]; then
+if test "$_sp_shell" = bash || test -n "${ZSH_VERSION:-}"; then
source $_sp_share_dir/spack-completion.bash
fi