feat(awsplugin): use acp command to switch profile without the right prompt
This commit is contained in:
parent
a7e30b26ba
commit
2053c8a9f6
@ -15,17 +15,26 @@ function agp {
|
|||||||
function asp {
|
function asp {
|
||||||
local rprompt=${RPROMPT/<aws:$(agp)>/}
|
local rprompt=${RPROMPT/<aws:$(agp)>/}
|
||||||
|
|
||||||
export AWS_DEFAULT_PROFILE=$1
|
switch_profile $1
|
||||||
export AWS_PROFILE=$1
|
|
||||||
|
|
||||||
export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>$rprompt"
|
export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>$rprompt"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function acp {
|
||||||
|
switch_profile $1
|
||||||
|
}
|
||||||
|
|
||||||
|
function switch_profile {
|
||||||
|
export AWS_DEFAULT=$1
|
||||||
|
export AWS_PROFILE=$1
|
||||||
|
}
|
||||||
|
|
||||||
function aws_profiles {
|
function aws_profiles {
|
||||||
reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_-]*\).*/\1/'))
|
reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_-]*\).*/\1/'))
|
||||||
}
|
}
|
||||||
|
|
||||||
compctl -K aws_profiles asp
|
compctl -K aws_profiles asp
|
||||||
|
compctl -K aws_profiles acp
|
||||||
|
|
||||||
if _homebrew-installed && _awscli-homebrew-installed ; then
|
if _homebrew-installed && _awscli-homebrew-installed ; then
|
||||||
_aws_zsh_completer_path=$(brew --prefix awscli)/libexec/bin/aws_zsh_completer.sh
|
_aws_zsh_completer_path=$(brew --prefix awscli)/libexec/bin/aws_zsh_completer.sh
|
||||||
|
Loading…
Reference in New Issue
Block a user