aboutsummaryrefslogtreecommitdiff
path: root/internal/p10k.zsh
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2020-01-31 12:52:34 +0300
committerromkatv <roman.perepelitsa@gmail.com>2020-01-31 12:52:34 +0300
commitf91597fe7bae81c23ad315efe7c7327db09d40ae (patch)
tree2a9755dfcf1c43537faafa6868fa6ca64de285e3 /internal/p10k.zsh
parentecc0157d94b2faa505a3d8a9ccfc9d0205ee74bd (diff)
speed up terraform, add classes to configs, bump version
Diffstat (limited to 'internal/p10k.zsh')
-rw-r--r--internal/p10k.zsh16
1 files changed, 7 insertions, 9 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index 5ba6159d..55922b90 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -209,6 +209,7 @@ function _p9k_read_word() {
_p9k_ret=${cached#*:}
else
local rest
+ _p9k_ret=
{ read _p9k_ret rest <$1 } 2>/dev/null
_p9k__read_word_cache[$1]=$stat[1]:$_p9k_ret
fi
@@ -4298,14 +4299,11 @@ function instant_prompt_nix_shell() {
}
function prompt_terraform() {
- local ws=default
- if [[ -n $TF_WORKSPACE ]]; then
- ws=$TF_WORKSPACE
- else
- local f=${TF_DATA_DIR:-.terraform}/environment
- [[ -r $f ]] && _p9k_read_file $f && ws=$_p9k_ret
+ local ws=$TF_WORKSPACE
+ if [[ -z $TF_WORKSPACE ]]; then
+ _p9k_read_word ${${TF_DATA_DIR:-.terraform}:A}/environment && ws=$_p9k_ret
fi
- ws=${${ws##[[:space:]]#}%%[[:space:]]#}
+ [[ $ws == (|default) ]] && return
local pat class
for pat class in "${_POWERLEVEL9K_TERRAFORM_CLASSES[@]}"; do
if [[ $ws == ${~pat} ]]; then
@@ -4313,7 +4311,7 @@ function prompt_terraform() {
break
fi
done
- [[ $ws == default ]] || _p9k_prompt_segment "$0$state" $_p9k_color1 blue TERRAFORM_ICON 0 '' $ws
+ _p9k_prompt_segment "$0$state" $_p9k_color1 blue TERRAFORM_ICON 0 '' $ws
}
_p9k_prompt_terraform_init() {
@@ -6457,7 +6455,7 @@ _p9k_must_init() {
[[ $sig == $_p9k__param_sig ]] && return 1
_p9k_deinit
fi
- _p9k__param_pat=$'v32\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1'
+ _p9k__param_pat=$'v33\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1'
_p9k__param_pat+=$'${#parameters[(I)POWERLEVEL9K_*]}\1${(%):-%n%#}\1$GITSTATUS_LOG_LEVEL\1'
_p9k__param_pat+=$'$GITSTATUS_ENABLE_LOGGING\1$GITSTATUS_DAEMON\1$GITSTATUS_NUM_THREADS\1'
_p9k__param_pat+=$'$DEFAULT_USER\1${ZLE_RPROMPT_INDENT:-1}\1$P9K_SSH\1$__p9k_ksh_arrays'