1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-12-18 21:41:57 +00:00

add terraform prompt segment

This commit is contained in:
romkatv 2019-08-19 16:07:59 +02:00
parent 37c6ea091e
commit 4c12eb7224
4 changed files with 31 additions and 0 deletions

View file

@ -56,6 +56,7 @@ fi
rbenv # ruby version from rbenv (https://github.com/rbenv/rbenv) rbenv # ruby version from rbenv (https://github.com/rbenv/rbenv)
rvm # ruby version from rvm (https://rvm.io) rvm # ruby version from rvm (https://rvm.io)
kubecontext # current kubernetes context (https://kubernetes.io/) kubecontext # current kubernetes context (https://kubernetes.io/)
terraform # terraform workspace (https://www.terraform.io)
context # user@host context # user@host
nordvpn # nordvpn connection status, linux only (https://nordvpn.com/) nordvpn # nordvpn connection status, linux only (https://nordvpn.com/)
ranger # ranger shell (https://github.com/ranger/ranger) ranger # ranger shell (https://github.com/ranger/ranger)
@ -540,6 +541,12 @@ fi
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_RVM_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_RVM_VISUAL_IDENTIFIER_EXPANSION='⭐'
################[ terraform: terraform workspace (https://www.terraform.io) ]#################
# Terraform color.
typeset -g POWERLEVEL9K_TERRAFORM_FOREGROUND=38
# Custom icon.
# typeset -g POWERLEVEL9K_TERRAFORM_VISUAL_IDENTIFIER_EXPANSION='⭐'
#############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]#############
# Kubernetes context classes for the purpose of using different colors, icons and expansions with # Kubernetes context classes for the purpose of using different colors, icons and expansions with
# different contexts. # different contexts.

View file

@ -56,6 +56,7 @@ fi
rbenv # ruby version from rbenv (https://github.com/rbenv/rbenv) rbenv # ruby version from rbenv (https://github.com/rbenv/rbenv)
rvm # ruby version from rvm (https://rvm.io) rvm # ruby version from rvm (https://rvm.io)
kubecontext # current kubernetes context (https://kubernetes.io/) kubecontext # current kubernetes context (https://kubernetes.io/)
terraform # terraform workspace (https://www.terraform.io)
context # user@host context # user@host
nordvpn # nordvpn connection status, linux only (https://nordvpn.com/) nordvpn # nordvpn connection status, linux only (https://nordvpn.com/)
ranger # ranger shell (https://github.com/ranger/ranger) ranger # ranger shell (https://github.com/ranger/ranger)
@ -595,6 +596,12 @@ fi
# Custom prefix. # Custom prefix.
# typeset -g POWERLEVEL9K_KUBECONTEXT_PREFIX='%fat ' # typeset -g POWERLEVEL9K_KUBECONTEXT_PREFIX='%fat '
################[ terraform: terraform workspace (https://www.terraform.io) ]#################
# Terraform color.
typeset -g POWERLEVEL9K_TERRAFORM_FOREGROUND=38
# Custom icon.
# typeset -g POWERLEVEL9K_TERRAFORM_VISUAL_IDENTIFIER_EXPANSION='⭐'
###############################[ public_ip: public IP address ]############################### ###############################[ public_ip: public IP address ]###############################
# Public IP color. # Public IP color.
typeset -g POWERLEVEL9K_PUBLIC_IP_FOREGROUND=94 typeset -g POWERLEVEL9K_PUBLIC_IP_FOREGROUND=94

View file

@ -109,6 +109,7 @@ function _p9k_init_icons() {
JAVA_ICON '\U2615' # ☕︎ JAVA_ICON '\U2615' # ☕︎
LARAVEL_ICON '' LARAVEL_ICON ''
RANGER_ICON '\u2B50' # ⭐ RANGER_ICON '\u2B50' # ⭐
TERRAFORM_ICON '\U1F6E0\u00A0' # 🛠️
) )
;; ;;
'awesome-fontconfig') 'awesome-fontconfig')
@ -207,6 +208,7 @@ function _p9k_init_icons() {
JAVA_ICON '\U2615' # ☕︎ JAVA_ICON '\U2615' # ☕︎
LARAVEL_ICON '' LARAVEL_ICON ''
RANGER_ICON '\u2B50' # ⭐ RANGER_ICON '\u2B50' # ⭐
TERRAFORM_ICON '\U1F6E0\u00A0' # 🛠️
) )
;; ;;
'awesome-mapped-fontconfig') 'awesome-mapped-fontconfig')
@ -309,6 +311,7 @@ function _p9k_init_icons() {
JAVA_ICON '\U2615' # ☕︎ JAVA_ICON '\U2615' # ☕︎
LARAVEL_ICON '' LARAVEL_ICON ''
RANGER_ICON '\u2B50' # ⭐ RANGER_ICON '\u2B50' # ⭐
TERRAFORM_ICON '\U1F6E0\u00A0' # 🛠️
) )
;; ;;
'nerdfont-complete'|'nerdfont-fontconfig') 'nerdfont-complete'|'nerdfont-fontconfig')
@ -408,6 +411,7 @@ function _p9k_init_icons() {
JAVA_ICON '\U2615' # ☕︎ JAVA_ICON '\U2615' # ☕︎
LARAVEL_ICON '\ue73f ' #  LARAVEL_ICON '\ue73f ' # 
RANGER_ICON '\u2B50' # ⭐ RANGER_ICON '\u2B50' # ⭐
TERRAFORM_ICON '\U1F6E0\u00A0' # 🛠️
) )
;; ;;
*) *)
@ -506,6 +510,7 @@ function _p9k_init_icons() {
JAVA_ICON '\U2615' # ☕︎ JAVA_ICON '\U2615' # ☕︎
LARAVEL_ICON '' LARAVEL_ICON ''
RANGER_ICON '\u2B50' # ⭐ RANGER_ICON '\u2B50' # ⭐
TERRAFORM_ICON 'TF'
) )
;; ;;
esac esac

View file

@ -3039,6 +3039,18 @@ function prompt_ranger() {
_p9k_prompt_segment $0 $_p9k_color1 yellow RANGER_ICON 0 '' $RANGER_LEVEL _p9k_prompt_segment $0 $_p9k_color1 yellow RANGER_ICON 0 '' $RANGER_LEVEL
} }
function prompt_terraform() {
(( $+commands[terraform] )) || return
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
fi
[[ $ws == default ]] || _p9k_prompt_segment $0 $_p9k_color1 blue TERRAFORM_ICON 0 '' $ws
}
_p9k_preexec() { _p9k_preexec() {
if (( $+_p9k_real_zle_rprompt_indent )); then if (( $+_p9k_real_zle_rprompt_indent )); then
if [[ -n $_p9k_real_zle_rprompt_indent ]]; then if [[ -n $_p9k_real_zle_rprompt_indent ]]; then