mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-13 14:03:53 -05:00
Add fish prompt changing (#475)
This commit is contained in:
@@ -245,7 +245,20 @@ if [ -z "${PYENV_VIRTUALENV_DISABLE_PROMPT}" ]; then
|
||||
case "${shell}" in
|
||||
fish )
|
||||
if [ -z "${QUIET}" ]; then
|
||||
echo "pyenv-virtualenv: prompt changing not working for fish." 1>&2
|
||||
cat <<EOS
|
||||
functions -e _pyenv_old_prompt # remove old prompt function if exists.
|
||||
# since everything is in memory, it's safe to
|
||||
# remove it.
|
||||
functions -c fish_prompt _pyenv_old_prompt # backup old prompt function
|
||||
|
||||
# from python-venv
|
||||
function fish_prompt
|
||||
set -l prompt (_pyenv_old_prompt) # call old prompt function first since it might
|
||||
# read exit status
|
||||
echo -n "(${venv}) " # add virtualenv to prompt
|
||||
string join -- \n \$prompt # handle multiline prompts
|
||||
end
|
||||
EOS
|
||||
fi
|
||||
;;
|
||||
* )
|
||||
|
||||
Reference in New Issue
Block a user