d16adb6a9f9b0ea46121f48751a012f0511b465b

Author
dorons <doron.segev@gmail.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

aws: fix path resolution of aws completion for Ubuntu (#7812)

Diff

 1diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh
 2index 0895cfb3a8c4c0b6536011dc253e36d439557a1d..4bec304908b08f07fcda1a58ea0eefdd6302be9a 100644
 3--- a/plugins/aws/aws.plugin.zsh
 4+++ b/plugins/aws/aws.plugin.zsh
 5@@ -67,11 +67,18 @@ _awscli-homebrew-installed() {
 6 # get aws_zsh_completer.sh location from $PATH
 7 _aws_zsh_completer_path="$commands[aws_zsh_completer.sh]"
 8 
 9-# otherwise check if installed via Homebrew
10-if [[ -z $_aws_zsh_completer_path ]] && _awscli-homebrew-installed; then
11-  _aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh
12-else
13-  _aws_zsh_completer_path=/usr/share/zsh/site-functions/aws_zsh_completer.sh
14+# otherwise check common locations
15+if [[ -z $_aws_zsh_completer_path ]]; then
16+  # Homebrew
17+  if _awscli-homebrew-installed; then
18+    _aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh
19+  # Ubuntu
20+  elif [[ -e /usr/share/zsh/vendor-completions/_awscli ]]; then
21+    _aws_zsh_completer_path=/usr/share/zsh/vendor-completions/_awscli
22+  # RPM
23+  else
24+    _aws_zsh_completer_path=/usr/share/zsh/site-functions/aws_zsh_completer.sh
25+  fi
26 fi
27 
28 [[ -r $_aws_zsh_completer_path ]] && source $_aws_zsh_completer_path