Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintain control flow, cd-ing in other functions #34

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions conf.d/pipenv.fish
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,31 @@ function __pipenv_shell_activate --on-variable PWD
if not test -e "$PWD/Pipfile"
if not string match -q "$__pipenv_fish_initial_pwd"/'*' "$PWD/"
set -U __pipenv_fish_final_pwd "$PWD"
exit
deactivate or exit
end
return
end

if not test -n "$PIPENV_ACTIVE"
if pipenv --venv >/dev/null 2>&1
set -x __pipenv_fish_initial_pwd "$PWD"
set -x __pipenv_fish_initial_pwd "$PWD"

if [ "$pipenv_fish_fancy" = 'yes' ]
set -- __pipenv_fish_arguments $__pipenv_fish_arguments --fancy
end
if [ "$pipenv_fish_fancy" = 'yes' ]
set -- __pipenv_fish_arguments $__pipenv_fish_arguments --fancy
end

pipenv shell $__pipenv_fish_arguments
set curcmd (status current-command)
if [ "$curcmd" = 'cd' -o "$curcmd" = "__pipenv_shell_activate" ]
pipenv shell $__pipenv_fish_arguments
else
. $(pipenv --venv)/bin/activate.fish
end

set -e __pipenv_fish_initial_pwd
if test -n "$__pipenv_fish_final_pwd"
cd "$__pipenv_fish_final_pwd"
set -e __pipenv_fish_final_pwd
end
set -e __pipenv_fish_initial_pwd
if test -n "$__pipenv_fish_final_pwd"
cd "$__pipenv_fish_final_pwd"
set -e __pipenv_fish_final_pwd
end
end
end
end