diff options
author | romkatv <roman.perepelitsa@gmail.com> | 2019-12-06 01:53:30 +0300 |
---|---|---|
committer | romkatv <roman.perepelitsa@gmail.com> | 2019-12-06 01:53:30 +0300 |
commit | a8f9527079e15588af3e98f94f3c6a427664ddce (patch) | |
tree | 1ef8328fe1cb4f790420327bd0ddf287f37ba3c9 /internal | |
parent | 5fc38b05869b040c2e85234359a86312c3f339c9 (diff) |
add gcloud prompt segment; fixes #366
Diffstat (limited to 'internal')
-rw-r--r-- | internal/icons.zsh | 5 | ||||
-rw-r--r-- | internal/p10k.zsh | 13 |
2 files changed, 18 insertions, 0 deletions
diff --git a/internal/icons.zsh b/internal/icons.zsh index 23433d56..95d38888 100644 --- a/internal/icons.zsh +++ b/internal/icons.zsh @@ -119,6 +119,7 @@ function _p9k_init_icons() { AZURE_ICON '\u2601' # ☁ DIRENV_ICON '\u25BC' # ▼ FLUTTER_ICON 'F' + GCLOUD_ICON 'G' ) ;; 'awesome-fontconfig') @@ -225,6 +226,7 @@ function _p9k_init_icons() { AZURE_ICON '\u2601' # ☁ DIRENV_ICON '\u25BC' # ▼ FLUTTER_ICON 'F' + GCLOUD_ICON 'G' ) ;; 'awesome-mapped-fontconfig') @@ -335,6 +337,7 @@ function _p9k_init_icons() { AZURE_ICON '\u2601' # ☁ DIRENV_ICON '\u25BC' # ▼ FLUTTER_ICON 'F' + GCLOUD_ICON 'G' ) ;; 'nerdfont-complete'|'nerdfont-fontconfig') @@ -442,6 +445,7 @@ function _p9k_init_icons() { AZURE_ICON '\uFD03' # ﴃ DIRENV_ICON '\u25BC' # ▼ FLUTTER_ICON 'F' + GCLOUD_ICON '\uF7B7' # ) ;; *) @@ -548,6 +552,7 @@ function _p9k_init_icons() { AZURE_ICON '\u2601' # ☁ DIRENV_ICON '\u25BC' # ▼ FLUTTER_ICON 'F' + GCLOUD_ICON 'G' ) ;; esac diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 56bd9fae..f0f0707e 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -3351,6 +3351,19 @@ prompt_azure() { _p9k_prompt_segment "$0" "blue" "white" "AZURE_ICON" 0 '' "${_p9k_cache_val[1]//\%/%%}" } +prompt_gcloud() { + unset P9K_GCLOUD_PROJECT P9K_GCLOUD_ACCOUNT + (( $+commands[gcloud] )) || return + local cfg=${AZURE_CONFIG_DIR:-$HOME/.azure}/azureProfile.json + if ! _p9k_cache_stat_get $0 ~/.config/gcloud/active_config ~/.config/gcloud/configurations/config_default; then + _p9k_cache_stat_set "$(gcloud config get-value account 2>/dev/null)" "$(gcloud config get-value project 2>/dev/null)" + fi + [[ -n $_p9k_cache_val[1] || -n $_p9k_cache_val[2] ]] || return + P9K_GCLOUD_ACCOUNT=$_p9k_cache_val[1] + P9K_GCLOUD_PROJECT=$_p9k_cache_val[2] + _p9k_prompt_segment "$0" "blue" "white" "GCLOUD_ICON" 0 '' "${P9K_GCLOUD_ACCOUNT//\%/%%}:${P9K_GCLOUD_PROJECT//\%/%%}" +} + typeset -gra __p9k_nordvpn_tag=( P9K_NORDVPN_STATUS P9K_NORDVPN_TECHNOLOGY |