mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-18 10:22:00 +00:00
feat(aws): allow more customisation in prompt function (#11619)
This commit is contained in:
parent
673b9fc331
commit
9139d30ca3
2 changed files with 8 additions and 3 deletions
|
@ -58,6 +58,8 @@ the current `$AWS_PROFILE` and `$AWS_REGION`. It uses four variables to control
|
||||||
|
|
||||||
* ZSH_THEME_AWS_REGION_SUFFIX: sets the suffix of the AWS_REGION. Defaults to `>`.
|
* ZSH_THEME_AWS_REGION_SUFFIX: sets the suffix of the AWS_REGION. Defaults to `>`.
|
||||||
|
|
||||||
|
* ZSH_THEME_AWS_DIVIDER: sets the divider between ZSH_THEME_AWS_PROFILE_SUFFIX and ZSH_THEME_AWS_REGION_PREFIX. Defaults to ` ` (single space).
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
[Configuration and credential file settings](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) by AWS
|
[Configuration and credential file settings](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) by AWS
|
||||||
|
|
|
@ -223,13 +223,16 @@ compctl -K _aws_profiles asp acp aws_change_access_key
|
||||||
function aws_prompt_info() {
|
function aws_prompt_info() {
|
||||||
local _aws_to_show
|
local _aws_to_show
|
||||||
local region="${AWS_REGION:-${AWS_DEFAULT_REGION:-$AWS_PROFILE_REGION}}"
|
local region="${AWS_REGION:-${AWS_DEFAULT_REGION:-$AWS_PROFILE_REGION}}"
|
||||||
|
|
||||||
if [[ -n $AWS_PROFILE ]];then
|
if [[ -n $AWS_PROFILE ]];then
|
||||||
_aws_to_show+="${ZSH_THEME_AWS_PROFILE_PREFIX:=<aws:}${AWS_PROFILE}${ZSH_THEME_AWS_PROFILE_SUFFIX:=>}"
|
_aws_to_show+="${ZSH_THEME_AWS_PROFILE_PREFIX="<aws:"}${AWS_PROFILE}${ZSH_THEME_AWS_PROFILE_SUFFIX=">"}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n $AWS_REGION ]]; then
|
if [[ -n $AWS_REGION ]]; then
|
||||||
[[ -n $AWS_PROFILE ]] && _aws_to_show+=" "
|
[[ -n $AWS_PROFILE ]] && _aws_to_show+="${ZSH_THEME_AWS_DIVIDER=' '}"
|
||||||
_aws_to_show+="${ZSH_THEME_AWS_REGION_PREFIX:=<region:}${region}${ZSH_THEME_AWS_REGION_SUFFIX:=>}"
|
_aws_to_show+="${ZSH_THEME_AWS_REGION_PREFIX="<region:"}${region}${ZSH_THEME_AWS_REGION_SUFFIX=">"}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$_aws_to_show"
|
echo "$_aws_to_show"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue