diff --git a/bullet-train.zsh-theme b/bullet-train.zsh-theme index c31cc96..bb52400 100644 --- a/bullet-train.zsh-theme +++ b/bullet-train.zsh-theme @@ -29,6 +29,7 @@ if [ ! -n "${BULLETTRAIN_PROMPT_ORDER+1}" ]; then virtualenv nvm aws + gcp go rust elixir @@ -118,6 +119,17 @@ if [ ! -n "${BULLETTRAIN_AWS_PREFIX+1}" ]; then BULLETTRAIN_AWS_PREFIX="☁️" fi +# GCP +if [ ! -n "${BULLETTRAIN_GCP_BG+1}" ]; then + BULLETTRAIN_GCP_BG=blue +fi +if [ ! -n "${BULLETTRAIN_GCP_FG+1}" ]; then + BULLETTRAIN_GCP_FG=white +fi +if [ ! -n "${BULLETTRAIN_GCP_PREFIX+1}" ]; then + BULLETTRAIN_GCP_PREFIX="G" +fi + # RUBY if [ ! -n "${BULLETTRAIN_RUBY_BG+1}" ]; then BULLETTRAIN_RUBY_BG=red @@ -596,6 +608,26 @@ prompt_aws() { fi } +#GCP Profile +prompt_gcp() { + local spaces=" " + + local gcp_profile="" + if [[ -n "${CLOUDSDK_ACTIVE_CONFIG_NAME}" && -f "$HOME/.config/gcloud/configurations/config_$CLOUDSDK_ACTIVE_CONFIG_NAME" ]]; then + gcp_profile="$CLOUDSDK_ACTIVE_CONFIG_NAME" + elif [[ -f "$HOME/.config/gcloud/active_config" ]]; then + gcp_profile=$(cat $HOME/.config/gcloud/active_config) + fi + + local gcp_project="" + if [[ -n "${gcp_profile}" ]]; then + gcp_project=$(awk '/project/{print $3}' $HOME/.config/gcloud/configurations/config_$gcp_profile) + fi + + if [[ -n "${gcp_project}" ]]; then + prompt_segment $BULLETTRAIN_GCP_BG $BULLETTRAIN_GCP_FG $BULLETTRAIN_GCP_PREFIX$spaces$gcp_project + fi +} # SCREEN Session prompt_screen() { local session_name="$STY"