dotfiles

My dotfiles, nothing really interesting to see ...
git clone https://git.onna.be/dotfiles.git
Log | Files | Refs | README

commit b04132f988cf439b299bc5e5b25c7ea8d0acc7cf
parent d2e3d72318fa0242e2ed311695a1c1605a1abfe3
Author: Paco Esteban <paco@onna.be>
Date:   Tue, 26 Jun 2018 13:01:50 +0200

gcloud prompt indicator. It is crude, we could use some caching ...

Diffstat:
zsh/.zsh/agnoster.zsh-theme | 9+++++++++
zsh/.zsh/aliases.zsh | 13+++++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/zsh/.zsh/agnoster.zsh-theme b/zsh/.zsh/agnoster.zsh-theme @@ -148,6 +148,14 @@ prompt_k8s() { print -n "$(kube_ps1)" fi } +# +# Display gcloud info if flag is on +prompt_gcloud() { + if [[ -n $GCLOUD_PROMPT ]]; then + prompt_segment 39 $PRIMARY_FG + print -n "$(gcloud_active_config)" + fi +} ## Main prompt prompt_agnoster_main() { @@ -157,6 +165,7 @@ prompt_agnoster_main() { prompt_context prompt_virtualenv prompt_k8s + prompt_gcloud prompt_dir prompt_git prompt_end diff --git a/zsh/.zsh/aliases.zsh b/zsh/.zsh/aliases.zsh @@ -199,3 +199,16 @@ function pastesrv() { ${=CLIP_COMMAND} echo '' } + +# google cloud prompt helper +function gCon () { + export GCLOUD_PROMPT="true" +} + +function gCoff () { + unset GCLOUD_PROMPT +} +function gcloud_active_config () { + GCLOUD_CONFIG=$(gcloud config configurations list | awk '$2=="True" {print $1}') + echo "(gC:${GCLOUD_CONFIG})" +}