diff options
author | romkatv <roman.perepelitsa@gmail.com> | 2020-03-21 20:11:44 +0300 |
---|---|---|
committer | romkatv <roman.perepelitsa@gmail.com> | 2020-03-21 20:11:44 +0300 |
commit | 90d19e6f97dfde0709148a27ea0c2f0f248398d7 (patch) | |
tree | 8a4c62c6a2cb197d61e6809538758aed79ced187 /config/p10k-classic.zsh | |
parent | 2468ccdb5e941ef2a8dbbf72e68ba1a3abe40541 (diff) |
enable the display of project name in gcloud segment
Details:
https://github.com/romkatv/powerlevel10k/issues/318#issuecomment-602037792
Diffstat (limited to 'config/p10k-classic.zsh')
-rw-r--r-- | config/p10k-classic.zsh | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh index 30125668..a923b4be 100644 --- a/config/p10k-classic.zsh +++ b/config/p10k-classic.zsh @@ -1241,14 +1241,36 @@ # Google cloud color. typeset -g POWERLEVEL9K_GCLOUD_FOREGROUND=32 - # Google cloud format. Change the value of POWERLEVEL9K_GCLOUD_CONTENT_EXPANSION if the default - # is too verbose or not informative enough. - # - # P9K_GCLOUD_ACCOUNT: the output of `gcloud config get-value account` - # P9K_GCLOUD_PROJECT: the output of `gcloud config get-value project` - # ${VARIABLE//\%/%%}: ${VARIABLE} with all occurences of '%' replaced with '%%'. - # - typeset -g POWERLEVEL9K_GCLOUD_CONTENT_EXPANSION='${P9K_GCLOUD_PROJECT//\%/%%}' + # Google cloud format. Change the value of POWERLEVEL9K_GCLOUD_PARTIAL_CONTENT_EXPANSION and/or + # POWERLEVEL9K_GCLOUD_COMPLETE_CONTENT_EXPANSION if the default is too verbose or not informative + # enough. You can use the following parameters in the expansions. Each of them corresponds to the + # output of `gcloud` tool. + # + # Parameter | Source + # -------------------------|-------------------------------------------------------------------- + # P9K_GCLOUD_CONFIGURATION | gcloud config configurations list --format='value(name)' + # P9K_GCLOUD_ACCOUNT | gcloud config get-value account + # P9K_GCLOUD_PROJECT_ID | gcloud config get-value project + # P9K_GCLOUD_PROJECT_NAME | gcloud projects describe $P9K_GCLOUD_PROJECT_ID --format='value(name)' + # + # Note: ${VARIABLE//\%/%%} expands to ${VARIABLE} with all occurences of '%' replaced with '%%'. + # + # Obtaining project name requires sending a request to Google servers. This can take a long time + # and even fail. When project name is unknown, P9K_GCLOUD_PROJECT_NAME is not set and gcloud + # prompt segment is in state PARTIAL. When project name gets known, P9K_GCLOUD_PROJECT_NAME gets + # set and gcloud prompt segment transitions to state COMPLETE. + # + # You can customize the format, icon and colors of gcloud segment separately for states PARTIAL + # and COMPLETE. You can also hide gcloud in state PARTIAL by setting + # POWERLEVEL9K_GCLOUD_PARTIAL_VISUAL_IDENTIFIER_EXPANSION and + # POWERLEVEL9K_GCLOUD_PARTIAL_CONTENT_EXPANSION to empty. + typeset -g POWERLEVEL9K_GCLOUD_PARTIAL_CONTENT_EXPANSION='${P9K_GCLOUD_PROJECT_ID//\%/%%}' + typeset -g POWERLEVEL9K_GCLOUD_COMPLETE_CONTENT_EXPANSION='${P9K_GCLOUD_PROJECT_NAME//\%/%%}' + + # Send a request to Google (by means of `gcloud projects describe ...`) to obtain project name + # this often. Negative value disables periodic polling. In this mode project name is retrieved + # only when the current configuration, account or project id changes. + typeset -g POWERLEVEL9K_GCLOUD_REFRESH_PROJECT_NAME_SECONDS=60 # Custom icon. # typeset -g POWERLEVEL9K_GCLOUD_VISUAL_IDENTIFIER_EXPANSION='⭐' |