db3d05fe7184a523fe4aba120bea962114424573

Author
Amir Tahvildaran <amir@bizequity.com>
Committer
GitHub <noreply@github.com>
Date

Message

aws: improve check for aws_completer - unhardcode path (#9123)

Closes #9122

The current check is assuming that the aws_completer is installed
globally, it then runs the command without that path

I have aws_completer in ~/.local/bin/aws_completer

This changes the check to see if the command exists instead of
concerning itself with where it in installed. This test matches the
behavior of just running the command.

Diff

 1diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh
 2index d00c2e56c54bbf89cb291918b13d6d6a6393b73b..7994963c323552ddd0c8ad7c2c6c65f9dc6790fd 100644
 3--- a/plugins/aws/aws.plugin.zsh
 4+++ b/plugins/aws/aws.plugin.zsh
 5@@ -63,7 +63,7 @@ fi
 6 # Load awscli completions
 7 
 8 # AWS CLI v2 comes with its own autocompletion. Check if that is there, otherwise fall back
 9-if [[ -x /usr/local/bin/aws_completer ]]; then
10+if command -v aws_completer &> /dev/null; then
11   autoload -Uz bashcompinit && bashcompinit
12   complete -C aws_completer aws
13 else