From 2053c8a9f68367ddd428a89e3b94787454112c3d Mon Sep 17 00:00:00 2001 From: Thomas Raimond Date: Fri, 27 Jan 2017 12:21:24 +0100 Subject: [PATCH] feat(awsplugin): use acp command to switch profile without the right prompt --- plugins/aws/aws.plugin.zsh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index d31052f83..43502cc9e 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -15,17 +15,26 @@ function agp { function asp { local rprompt=${RPROMPT//} - export AWS_DEFAULT_PROFILE=$1 - export AWS_PROFILE=$1 + switch_profile $1 export RPROMPT="$rprompt" } +function acp { + switch_profile $1 +} + +function switch_profile { + export AWS_DEFAULT=$1 + export AWS_PROFILE=$1 +} + function aws_profiles { reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_-]*\).*/\1/')) } compctl -K aws_profiles asp +compctl -K aws_profiles acp if _homebrew-installed && _awscli-homebrew-installed ; then _aws_zsh_completer_path=$(brew --prefix awscli)/libexec/bin/aws_zsh_completer.sh