Skip to content

Commit

Permalink
Write currently active env to prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
fmauch committed May 21, 2024
1 parent c2e2b05 commit 611cb8c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bin/rob_folders_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ fzirob()
if [ $? -eq 0 ]; then
if [ $1 = "change_environment" ] && [ "$2" != "--help" ]; then
checkout_dir=$(rob_folders get_checkout_base_dir)

if [ -f ${checkout_dir}/.cur_env ]; then
export ROB_FOLDERS_ACTIVE_ENV=$(cat ${checkout_dir}/.cur_env)
environment_dir="${checkout_dir}/${ROB_FOLDERS_ACTIVE_ENV}"
Expand All @@ -175,6 +176,11 @@ fzirob()
# declare environment-specific aliases
env_aliases
#check_env
# Write current env to prompt
if [ -z "${ROB_FOLDERS_DISABLE_PROMPT_MODIFICATION:-}" ] ; then
PS1="[${ROB_FOLDERS_ACTIVE_ENV}] ${PS1:-}"
export PS1
fi
else
echo "Could not change environment"
fi
Expand Down
9 changes: 9 additions & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,12 @@ Directory options
Location where build and install steps should be performed if they should be outside of the
checkout tree. If that folder exists, users will be prompted whether to build inside the
``no_backup_dir`` when creating a new environment.

Environment variables
---------------------

There are also environment variables for some features of ``robot_folders``:

``ROB_FOLDERS_DISABLE_PROMPT_MODIFICATION``
If this variable is set to a non-empty value, the currently active environment will **not** be
added to the prompt.

0 comments on commit 611cb8c

Please sign in to comment.