mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-30 02:44:42 +01:00
feat(python): pattern matching in auto_vrun
This commit is contained in:
parent
668ca3a32d
commit
26b3467806
2 changed files with 10 additions and 6 deletions
|
|
@ -87,11 +87,14 @@ function mkv() {
|
|||
if [[ "$PYTHON_AUTO_VRUN" == "true" ]]; then
|
||||
# Automatically activate venv when changing dir
|
||||
auto_vrun() {
|
||||
if [[ -f "${PYTHON_VENV_NAME}/bin/activate" ]]; then
|
||||
source "${PYTHON_VENV_NAME}/bin/activate" > /dev/null 2>&1
|
||||
else
|
||||
(( $+functions[deactivate] )) && deactivate > /dev/null 2>&1
|
||||
fi
|
||||
for activator in "${PYTHON_VENV_NAME}"*/bin/activate(N); do
|
||||
if [[ -f "${activator}" ]]; then
|
||||
source "${activator}" > /dev/null 2>&1
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
(( $+functions[deactivate] )) && deactivate > /dev/null 2>&1
|
||||
}
|
||||
add-zsh-hook chpwd auto_vrun
|
||||
auto_vrun
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue