diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2023-11-05 02:15:37 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-05 10:15:37 +0000 |
commit | f6b23b4653c73f60e826086154cad3040c1b61a7 (patch) | |
tree | 703846b3cf3f02ec16fce8688cdb62681e3aea26 /share | |
parent | 4755b28398da08a424ab159fa425a25e3966dab3 (diff) | |
download | spack-f6b23b4653c73f60e826086154cad3040c1b61a7.tar.gz spack-f6b23b4653c73f60e826086154cad3040c1b61a7.tar.bz2 spack-f6b23b4653c73f60e826086154cad3040c1b61a7.tar.xz spack-f6b23b4653c73f60e826086154cad3040c1b61a7.zip |
bugfix: compress aliases for first command in completion (#40890)
This completes to `spack concretize`:
```
spack conc<tab>
```
but this still gets hung up on the difference between `concretize` and `concretise`:
```
spack -e . conc<tab>
```
We were checking `"$COMP_CWORD" = 1`, which tracks the word on the command line
including any flags and their args, but we should track `"$COMP_CWORD_NO_FLAGS" = 1` to
figure out if the arg we're completing is the first real command.
Diffstat (limited to 'share')
-rwxr-xr-x | share/spack/bash/spack-completion.bash | 2 | ||||
-rwxr-xr-x | share/spack/spack-completion.bash | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/share/spack/bash/spack-completion.bash b/share/spack/bash/spack-completion.bash index 49c691be4c..9a5b367be7 100755 --- a/share/spack/bash/spack-completion.bash +++ b/share/spack/bash/spack-completion.bash @@ -370,7 +370,7 @@ _spack_compress_aliases() { # If there are zero or one completions, don't do anything # If this isn't the first argument, bail because aliases currently only apply # to top-level commands. - if [ "${#COMPREPLY[@]}" -le "1" ] || [ "$COMP_CWORD" != "1" ]; then + if [ "${#COMPREPLY[@]}" -le "1" ] || [ "$COMP_CWORD_NO_FLAGS" != "1" ]; then return fi diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash index 84b6c3dc1f..91ed9dd172 100755 --- a/share/spack/spack-completion.bash +++ b/share/spack/spack-completion.bash @@ -370,7 +370,7 @@ _spack_compress_aliases() { # If there are zero or one completions, don't do anything # If this isn't the first argument, bail because aliases currently only apply # to top-level commands. - if [ "${#COMPREPLY[@]}" -le "1" ] || [ "$COMP_CWORD" != "1" ]; then + if [ "${#COMPREPLY[@]}" -le "1" ] || [ "$COMP_CWORD_NO_FLAGS" != "1" ]; then return fi |