Detect aws cli completion file from RPM (#6424).

This commit is contained in:
Frank Gruellich 2017-11-16 09:02:05 +01:00
parent e273cf004e
commit 74459a9818

View File

@ -21,6 +21,10 @@ _awscli-homebrew-installed() {
[ -r $_brew_prefix/libexec/bin/aws_zsh_completer.sh ] &> /dev/null [ -r $_brew_prefix/libexec/bin/aws_zsh_completer.sh ] &> /dev/null
} }
_awscli-rpm-installed() {
which rpm &>/dev/null && rpm -q --quiet awscli
}
export AWS_HOME=~/.aws export AWS_HOME=~/.aws
function agp { function agp {
@ -44,9 +48,11 @@ compctl -K aws_profiles asp
if _homebrew-installed && _awscli-homebrew-installed ; then if _homebrew-installed && _awscli-homebrew-installed ; then
_aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh _aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh
elif _awscli-rpm-installed; then
_aws_zsh_completer_path="/usr/share/zsh/site-functions/aws_zsh_completer.sh"
else else
_aws_zsh_completer_path=$(which aws_zsh_completer.sh) _aws_zsh_completer_path=$(which aws_zsh_completer.sh)
fi fi
[ -x $_aws_zsh_completer_path ] && source $_aws_zsh_completer_path [ -r $_aws_zsh_completer_path ] && source $_aws_zsh_completer_path
unset _aws_zsh_completer_path unset _aws_zsh_completer_path