Created
March 14, 2017 20:15
-
-
Save SteveByerly/9e8a6e313e7e996228fbe0faad65e2b1 to your computer and use it in GitHub Desktop.
Custom version of aws ZSH plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_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 { | |
local rprompt=${RPROMPT/<aws:$(agp)>/} | |
export AWS_DEFAULT_PROFILE=$1 | |
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 | |
# This is the default install location for homebrew. brew and | |
# brew list are very slow, so we'll check the default path first | |
if [ -f "/usr/local/bin/aws_zsh_completer.sh" ]; then | |
_aws_zsh_completer_path="/usr/local/bin/aws_zsh_completer.sh" | |
elif _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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment