mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-30 02:44:42 +01:00
feat(python): don't auto-deactivate in a subdir
This commit is contained in:
parent
26b3467806
commit
1965d1b3fc
2 changed files with 15 additions and 8 deletions
|
|
@ -86,12 +86,19 @@ function mkv() {
|
|||
|
||||
if [[ "$PYTHON_AUTO_VRUN" == "true" ]]; then
|
||||
# Automatically activate venv when changing dir
|
||||
auto_vrun() {
|
||||
for activator in "${PYTHON_VENV_NAME}"*/bin/activate(N); do
|
||||
if [[ -f "${activator}" ]]; then
|
||||
source "${activator}" > /dev/null 2>&1
|
||||
return
|
||||
fi
|
||||
function auto_vrun() {
|
||||
local dirname="$PWD"
|
||||
|
||||
while
|
||||
for activator in "${dirname}/${PYTHON_VENV_NAME}"*/bin/activate(N); do
|
||||
if [[ -f "${activator}" ]]; then
|
||||
source "${activator}" > /dev/null 2>&1
|
||||
return
|
||||
fi
|
||||
done
|
||||
[[ -n "$dirname" ]]
|
||||
do
|
||||
dirname=${dirname%/*}
|
||||
done
|
||||
|
||||
(( $+functions[deactivate] )) && deactivate > /dev/null 2>&1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue