aboutsummaryrefslogtreecommitdiff
path: root/internal/p10k.zsh
diff options
context:
space:
mode:
authorRostyslav Sotnychenko <me@sota.sh>2019-11-14 14:40:28 +0300
committerRoman Perepelitsa <roman.perepelitsa@gmail.com>2019-11-14 14:59:03 +0300
commit1e009cf43aada792c72414e244e116e932462bc5 (patch)
tree46c9e4a0c96f4170ecb5f7af6874fffe4175e9d6 /internal/p10k.zsh
parent707d7d66711eec1037916d60f52cf3d349a53e08 (diff)
Add support for classes for AWS profile prompt
Diffstat (limited to 'internal/p10k.zsh')
-rw-r--r--internal/p10k.zsh17
1 files changed, 13 insertions, 4 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index a2f0fab0..ec4a06d3 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -978,7 +978,15 @@ prompt_anaconda() {
prompt_aws() {
local aws_profile="${AWS_VAULT:-${AWSUME_PROFILE:-${AWS_PROFILE:-$AWS_DEFAULT_PROFILE}}}"
if [[ -n "$aws_profile" ]]; then
- _p9k_prompt_segment "$0" red white 'AWS_ICON' 0 '' "${aws_profile//\%/%%}"
+ local pat class
+ for pat class in "${_POWERLEVEL9K_AWS_CLASSES[@]}"; do
+ if [[ $aws_profile == ${~pat} ]]; then
+ [[ -n $class ]] && state=_${(U)class}
+ break
+ fi
+ done
+
+ _p9k_prompt_segment "$0$state" red white 'AWS_ICON' 0 '' "${aws_profile//\%/%%}"
fi
}
@@ -1085,7 +1093,7 @@ prompt_battery() {
local -a bats=( /sys/class/power_supply/(BAT*|battery)/(FN) )
(( $#bats )) || return
- local -i energy_now energy_full power_now
+ local -i energy_now energy_full power_now
local -i is_full=1 is_calculating is_charching
local dir
for dir in $bats; do
@@ -4439,7 +4447,7 @@ _p9k_init_async_pump() {
local ip_url=$_POWERLEVEL9K_PUBLIC_IP_HOST
local lock=$_p9k__async_pump_lock
local fifo=$_p9k__async_pump_fifo
- $functions[_p9k_async_pump]"
+ $functions[_p9k_async_pump]"
local setsid=${commands[setsid]:-/usr/local/opt/util-linux/bin/setsid}
[[ -f $setsid ]] && setsid=${(q)setsid} || setsid=
@@ -4602,7 +4610,7 @@ _p9k_init_vars() {
_p9k_init_params() {
# invarint: _POWERLEVEL9K_INSTANT_PROMPT == (verbose|quiet|off)
- # invariant: [[ ($_POWERLEVEL9K_INSTANT_PROMPT == off) == $_POWERLEVEL9K_DISABLE_INSTANT_PROMPT ]]
+ # invariant: [[ ($_POWERLEVEL9K_INSTANT_PROMPT == off) == $_POWERLEVEL9K_DISABLE_INSTANT_PROMPT ]]
_p9k_declare -s POWERLEVEL9K_INSTANT_PROMPT # verbose, quiet, off
if [[ $_POWERLEVEL9K_INSTANT_PROMPT == off ]]; then
typeset -gi _POWERLEVEL9K_DISABLE_INSTANT_PROMPT=1
@@ -4852,6 +4860,7 @@ _p9k_init_params() {
# POWERLEVEL9K_KUBECONTEXT_TESTING_BACKGROUND=green
# POWERLEVEL9K_KUBECONTEXT_OTHER_BACKGROUND=yellow
_p9k_declare -a POWERLEVEL9K_KUBECONTEXT_CLASSES --
+ _p9k_declare -a POWERLEVEL9K_AWS_CLASSES --
# Specifies the format of java version.
#
# POWERLEVEL9K_JAVA_VERSION_FULL=true => 1.8.0_212-8u212-b03-0ubuntu1.18.04.1-b03