Skip to content
Snippets Groups Projects
Commit d7ee603d authored by Juntong Liu's avatar Juntong Liu
Browse files

Merge branch 'improve_shell_prompt' into 'master'

E3-341: Improve the shell prompt to display e3 info

See merge request e3/e3-require!40
parents f9623e0b a81921fa
No related branches found
No related tags found
1 merge request!40E3-341: Improve the shell prompt to display e3 info
Pipeline #85892 passed
...@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* * Tests that the correct version is loaded * * Tests that the correct version is loaded
* * Tests that elementary patching/building works as expected * * Tests that elementary patching/building works as expected
* Added consistency check between e3 environment variables and path to `iocsh.bash`. `iocsh.bash` will abort if these are not consistent. * Added consistency check between e3 environment variables and path to `iocsh.bash`. `iocsh.bash` will abort if these are not consistent.
* Add e3 version infomation to the shell prompt
### Bugfixes ### Bugfixes
* `iocsh.bash --help` (and variants) no longer loads tries to load `env.sh`. * `iocsh.bash --help` (and variants) no longer loads tries to load `env.sh`.
......
...@@ -25,6 +25,15 @@ ...@@ -25,6 +25,15 @@
# #
# #
if [[ "$0" == "${BASH_SOURCE[0]}" ]]; then
echo
echo "##################################################"
echo "$0 is NOT properly sourced !"
echo "##################################################"
echo
exit 1
fi
# the following function drop_from_path was copied from # the following function drop_from_path was copied from
# the ROOT build system in ${ROOTSYS}/bin/, and modified # the ROOT build system in ${ROOTSYS}/bin/, and modified
# a little to return its result # a little to return its result
...@@ -336,3 +345,20 @@ export LD_LIBRARY_PATH ...@@ -336,3 +345,20 @@ export LD_LIBRARY_PATH
source "${SRC_PATH}"/iocsh_complete.bash source "${SRC_PATH}"/iocsh_complete.bash
print_env "$1" print_env "$1"
BASE_version="${EPICS_BASE##*/base-}"
E3_ENV_INFO="(${BASE_version}-${E3_REQUIRE_VERSION})"
NEW_E3_PS="${E3_ENV_INFO}\[\033[33m\]\u\[\033[m\]@\[\033[33;1m\]\w\[\033[m\]\$ "
if [ -z "$E3_ENV_ON" ]; then
if [ -z "$PS1" ]; then
export E3_ENV_ON="ON"
export PS1="${NEW_E3_PS}"
else
export E3_ENV_ON="ON"
export PS1="${E3_ENV_INFO}${PS1}"
fi
else
PS_TMP=${PS1#*\)}
export PS1="${E3_ENV_INFO}${PS_TMP}"
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment