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.
This commit is contained in:
		| @@ -370,7 +370,7 @@ _spack_compress_aliases() { | |||||||
|     # If there are zero or one completions, don't do anything |     # If there are zero or one completions, don't do anything | ||||||
|     # If this isn't the first argument, bail because aliases currently only apply |     # If this isn't the first argument, bail because aliases currently only apply | ||||||
|     # to top-level commands. |     # to top-level commands. | ||||||
|     if [ "${#COMPREPLY[@]}" -le "1" ] || [ "$COMP_CWORD" != "1" ]; then |     if [ "${#COMPREPLY[@]}" -le "1" ] || [ "$COMP_CWORD_NO_FLAGS" != "1" ]; then | ||||||
|         return |         return | ||||||
|     fi |     fi | ||||||
|  |  | ||||||
|   | |||||||
| @@ -370,7 +370,7 @@ _spack_compress_aliases() { | |||||||
|     # If there are zero or one completions, don't do anything |     # If there are zero or one completions, don't do anything | ||||||
|     # If this isn't the first argument, bail because aliases currently only apply |     # If this isn't the first argument, bail because aliases currently only apply | ||||||
|     # to top-level commands. |     # to top-level commands. | ||||||
|     if [ "${#COMPREPLY[@]}" -le "1" ] || [ "$COMP_CWORD" != "1" ]; then |     if [ "${#COMPREPLY[@]}" -le "1" ] || [ "$COMP_CWORD_NO_FLAGS" != "1" ]; then | ||||||
|         return |         return | ||||||
|     fi |     fi | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Todd Gamblin
					Todd Gamblin