Open rsgalloway opened 6 days ago
in addition, it looks like there is a "bug", or oversight, in the export and clear functions where it's unsetting env vars that are defined in the stack file, even if they existed in the old environment, e.g. PATH and PYTHONPATH:
$ envstack --export
...
export PATH="${BIN}:blah"
export PYTHONPATH="${LIB}:blah"
Then PATH and PYTHONPATH get unset unintentionally:
$ envstack --clear
...
unset PATH
unset PYTHONPATH
when they should really be restored to the old values:
$ envstack --clear
...
set PATH=${_OLD_PATH}
set PYTHONPATH=${_OLD_PYTHONPATH}
work in progress in branch issue10/prompt_strings
there is also a bug in envstack.init() that is clearing env vars like PATH and PYTHONPATH if they are defined in the stack .env file, which means if they are referenced like this PATH: ${BIN}:%{PATH}
then the values are cleared before they can be resolved
# clear vars from stack namespace
env = load_environ(name, environ=None)
for key in env.keys():
if key in os.environ:
del os.environ[key]
# store the name of the environment stack (e.g. for $PS1)
os.environ["ENVSTACK"] = name
# load the new environment
env = load_environ(name)
customize the prompt string $PS1 / %PROMPT% to display the current stack or environment.
something like this could be added to the stack file:
but I think what we want is the stack name: