From ea6826594accd4006b82d9e6e95b329101afb257 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Wed, 20 Dec 2017 20:02:20 +0100 Subject: zsh: in_google_cloud --- zsh/.zshrc | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'zsh') diff --git a/zsh/.zshrc b/zsh/.zshrc index ece46ac..b127914 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -91,6 +91,15 @@ stty -ixon # enable mapping of C-s in vim.. autoload -U colors && colors +in_google_cloud () { + curl metadata.google.internal -i &>/dev/null + if [[ $? -eq 0 ]]; then + echo "yes" + else + echo "no" + fi +} + # possible colors: black, white, green, cyan, red, yellow, magenta case `hostname` in bogues*|curry*|iverson*|jordan*|ming*|nowitzki*|oneal*|robinson*) @@ -101,11 +110,7 @@ case `hostname` in HOSTCOLOR_BG=blue HOSTCOLOR_FG=black ;; - ip-*) - HOSTCOLOR_BG=cyan - HOSTCOLOR_FG=black - ;; - 2pac|coltrane|donna|vicious|lemmy|CLuster|node*|gpu*) + 2pac|coltrane|donna|vicious|lemmy|CLuster) HOSTCOLOR_BG=green HOSTCOLOR_FG=black ;; @@ -115,6 +120,12 @@ case `hostname` in ;; esac +# google cloud +if [[ $(in_google_cloud) == "yes" ]]; then + HOSTCOLOR_BG=cyan + HOSTCOLOR_FG=white +fi + function chpwd { if [[ -e $ZDIR/functions ]] { -- cgit v1.2.3