darvid / zsh-poetry

🐚 Simple ZSH plugin for automatically activating and deactivating Poetry-created virtualenvs. 🐍
MIT License
75 stars 14 forks source link

Options settings ingnored #7

Open FranzFelberer opened 4 years ago

FranzFelberer commented 4 years ago

It seems that changing the options settings is ignored.

From my .zshrc

...
export ZSH_POETRY_AUTO_DEACTIVATE=0
export ZSH_POETRY_AUTO_ACTIVATE=0

# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Some plugins have to have a certain order (historu-substring-search after zsh-syntax-highlighting)

plugins=(
  autoupdate
  git
  pyenv
  poetry
  vi-mode
  zsh-autosuggestions
  zsh-completions
  zsh-nvm
  zsh-poetry
  zsh-syntax-highlighting
  history-substring-search
)
...

The venv gets still automatically activated and deactivate.

jpweytjens commented 4 years ago

I think this is the case because the code uses the -n flag in the if statements, which checks if the length of the string is non zero. This is the case for both ZSH_POETRY_AUTO_ACTIVATE=1 and ZSH_POETRY_AUTO_ACTIVATE=0. The expected behaviour is when these if statements are replaced with [[ $ZSH_POETRY_AUTO_DEACTIVATE -eq 1]] and equivalent for the ZSH_POETRY_AUTO_ACTIVATE.