mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-01 04:30:37 +02:00
feat(awsplugin): use acp command to switch profile without the right prompt
This commit is contained in:
parent
a7e30b26ba
commit
2053c8a9f6
1 changed files with 11 additions and 2 deletions
|
|
@ -15,17 +15,26 @@ function agp {
|
|||
function asp {
|
||||
local rprompt=${RPROMPT/<aws:$(agp)>/}
|
||||
|
||||
export AWS_DEFAULT_PROFILE=$1
|
||||
export AWS_PROFILE=$1
|
||||
switch_profile $1
|
||||
|
||||
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 {
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue