From 47a57533813d5ab11422964f4c348046f935b56f Mon Sep 17 00:00:00 2001 From: Sen Jiang Date: Wed, 11 May 2016 15:51:48 -0700 Subject: [PATCH] Support for advanced usage in custom message For example export BULLETTRAIN_CUSTOM_MSG=\$SOME_ENV_I_WANT_TO_SHOW export BULLETTRAIN_CUSTOM_MSG=\`some command I want to run\` --- README.md | 2 +- bullet-train.zsh-theme | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6be3e46..9371197 100644 --- a/README.md +++ b/README.md @@ -158,7 +158,7 @@ more details. |Variable|Default|Meaning |--------|-------|-------| -|`BULLETTRAIN_CUSTOM_MSG`|`false`|Free segment you can put a custom message +|`BULLETTRAIN_CUSTOM_MSG`|`false`|Free segment you can put a custom message which will be eval'ed for every prompt |`BULLETTRAIN_CUSTOM_BG`|`black`|Background color |`BULLETTRAIN_CUSTOM_FG`|`black`|Foreground color diff --git a/bullet-train.zsh-theme b/bullet-train.zsh-theme index 8314623..dbfd55a 100644 --- a/bullet-train.zsh-theme +++ b/bullet-train.zsh-theme @@ -380,7 +380,9 @@ prompt_custom() { return fi - prompt_segment $BULLETTRAIN_CUSTOM_BG $BULLETTRAIN_CUSTOM_FG "${BULLETTRAIN_CUSTOM_MSG}" + local custom_msg + eval custom_msg=$BULLETTRAIN_CUSTOM_MSG + [[ -n "${custom_msg}" ]] && prompt_segment $BULLETTRAIN_CUSTOM_BG $BULLETTRAIN_CUSTOM_FG "${custom_msg}" } # Git