summaryrefslogtreecommitdiff
path: root/plugins/aws/aws.plugin.zsh
diff options
context:
space:
mode:
authorDawid Ferenczy <dawid@ferenczy.cz>2015-08-25 16:34:04 +0200
committerDawid Ferenczy <dawid@ferenczy.cz>2015-08-25 16:34:04 +0200
commit18ef1ee6481dbeca4fbecf3de627f946860ffd5a (patch)
treecb07e72538c470bb486596d955c7912c5b05e23e /plugins/aws/aws.plugin.zsh
parenteafd5f325208421b82a770e57441dd1063eb5745 (diff)
parent192de6bcffb0294e19f4203f6f7dc1a7f3e427be (diff)
downloadzsh-18ef1ee6481dbeca4fbecf3de627f946860ffd5a.tar.gz
zsh-18ef1ee6481dbeca4fbecf3de627f946860ffd5a.tar.bz2
zsh-18ef1ee6481dbeca4fbecf3de627f946860ffd5a.zip
Merge remote-tracking branch 'robbyrussell/master'
Diffstat (limited to 'plugins/aws/aws.plugin.zsh')
-rw-r--r--plugins/aws/aws.plugin.zsh23
1 files changed, 19 insertions, 4 deletions
diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh
index 3f7fb1995..7246db9f0 100644
--- a/plugins/aws/aws.plugin.zsh
+++ b/plugins/aws/aws.plugin.zsh
@@ -1,17 +1,32 @@
+_homebrew-installed() {
+ type brew &> /dev/null
+}
+
+_awscli-homebrew-installed() {
+ brew list awscli &> /dev/null
+}
+
export AWS_HOME=~/.aws
function agp {
echo $AWS_DEFAULT_PROFILE
-
}
function asp {
export AWS_DEFAULT_PROFILE=$1
- export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>"
-
+ export AWS_PROFILE=$1
+ export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>$RPROMPT"
}
function aws_profiles {
reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_-]*\).*/\1/'))
}
compctl -K aws_profiles asp
-source `which aws_zsh_completer.sh`
+
+if _homebrew-installed && _awscli-homebrew-installed ; then
+ _aws_zsh_completer_path=$(brew --prefix awscli)/libexec/bin/aws_zsh_completer.sh
+else
+ _aws_zsh_completer_path=$(which aws_zsh_completer.sh)
+fi
+
+[ -x $_aws_zsh_completer_path ] && source $_aws_zsh_completer_path
+unset _aws_zsh_completer_path