aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Allen <[email protected]>2016-07-19 14:44:45 -0500
committerGitHub <[email protected]>2016-07-19 14:44:45 -0500
commit1f78af4823b56e00dc33c9847128450ddf07509f (patch)
treef0231e1fe477ad9a69c93c92c81d548b340a588d
parentee534691524ae2bb8521b40963da6b0dd75bf5b5 (diff)
parent759f73f59879a40279c7b5229e40d21f2c42231e (diff)
downloadkerl-1f78af4823b56e00dc33c9847128450ddf07509f.tar.gz
kerl-1f78af4823b56e00dc33c9847128450ddf07509f.tar.bz2
kerl-1f78af4823b56e00dc33c9847128450ddf07509f.zip
Merge pull request #149 from mazenharake/promptfrmt
Add support for customized prompt for activated installations
-rw-r--r--README.md5
-rwxr-xr-xkerl10
2 files changed, 13 insertions, 2 deletions
diff --git a/README.md b/README.md
index 1ffefbd..6576343 100644
--- a/README.md
+++ b/README.md
@@ -172,7 +172,10 @@ You can set the following variables:
- `KERL_SASL_STARTUP` use SASL system startup instead of minimal
- `KERL_DEPLOY_SSH_OPTIONS` if additional options are required, e.g. `-qx -o PasswordAuthentication=no`
- `KERL_DEPLOY_RSYNC_OPTIONS` if additional options are required, e.g. `--delete`
-- `KERL_ENABLE_PROMPT` if set, the prompt will be prefixed with the name of the active build
+- `KERL_ENABLE_PROMPT` if set, will enable the prompt to be prefixed with what is set in `KERL_PROMPT_FORMAT`.
+- `KERL_PROMPT_FORMAT` the format string to use as a prefix for the prompt. If not set (or empty) will default to `(%BUILDNAME%)`. The following variables are available for use in the format string.
+ - `%RELEASE%` The active release (e.g. `18.0` or `R16B02`)
+ - `%BUILDNAME%` The active buildname (e.g. `my_test_build_18.0`)
- `KERL_BUILD_DOCS` if set, will build documentation from source code repository
- `KERL_USE_AUTOCONF` use autoconf in the builds process (**note**: implied by the `git` build backend)
diff --git a/kerl b/kerl
index 70b5d7b..242829d 100755
--- a/kerl
+++ b/kerl
@@ -670,6 +670,8 @@ kerl_deactivate()
if [ ! "\$1" = "nondestructive" ]; then
unset -f kerl_deactivate
fi
+ unset KERL_ENABLE_PROMPT
+ unset KERL_PROMPT_FORMAT
}
kerl_deactivate nondestructive
@@ -689,7 +691,13 @@ if [ -f "$KERL_CONFIG" ]; then . "$KERL_CONFIG"; fi
if [ -n "\$KERL_ENABLE_PROMPT" ]; then
_KERL_SAVED_PS1="\$PS1"
export _KERL_SAVED_PS1
- PS1="($1)\$PS1"
+ if [ -n "\$KERL_PROMPT_FORMAT" ]; then
+ FRMT="\$KERL_PROMPT_FORMAT"
+ else
+ FRMT="(%BUILDNAME%)"
+ fi
+ PROMPT=\$(echo "\$FRMT" | sed 's^%RELEASE%^$rel^;s^%BUILDNAME%^$1^')
+ PS1="\$PROMPT\$PS1"
export PS1
fi
if [ -n "\$BASH" -o -n "\$ZSH_VERSION" ]; then