mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-05 01:46:46 +01:00
aws: refactor AWS plugin (#7615)
* Update the AWS plugin to support disabling RPROMT display: Use a $SHOW_AWS_PROMPT option. * Refactoring aws plugin: Exposing customizable aws_prompt_info function to be used in themes. * Set aws prompt prefix and suffix to original values and fix README Co-authored-by: "Vassilis S. Moustakas" <vsmoustakas@gmail.com>
This commit is contained in:
parent
5ff21efad7
commit
532a784b80
2 changed files with 36 additions and 9 deletions
|
|
@ -1,14 +1,16 @@
|
|||
# AWS profile selection
|
||||
|
||||
function agp {
|
||||
echo $AWS_PROFILE
|
||||
}
|
||||
|
||||
function asp {
|
||||
local rprompt=${RPROMPT/<aws:$AWS_PROFILE>/}
|
||||
|
||||
export AWS_DEFAULT_PROFILE=$1
|
||||
export AWS_PROFILE=$1
|
||||
|
||||
export RPROMPT="<aws:$AWS_PROFILE>$rprompt"
|
||||
if [[ -z "$1" ]]; then
|
||||
echo AWS profile cleared.
|
||||
fi
|
||||
}
|
||||
|
||||
function aws_profiles {
|
||||
|
|
@ -17,6 +19,18 @@ function aws_profiles {
|
|||
compctl -K aws_profiles asp
|
||||
|
||||
|
||||
# AWS prompt
|
||||
|
||||
function aws_prompt_info() {
|
||||
[[ -z $AWS_PROFILE ]] && return
|
||||
echo "${ZSH_THEME_AWS_PREFIX:=<aws:}${AWS_PROFILE}${ZSH_THEME_AWS_SUFFIX:=>}"
|
||||
}
|
||||
|
||||
if [ "$SHOW_AWS_PROMPT" != false ]; then
|
||||
export RPROMPT='$(aws_prompt_info)'"$RPROMPT"
|
||||
fi
|
||||
|
||||
|
||||
# Load awscli completions
|
||||
|
||||
_awscli-homebrew-installed() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue