Last active
August 31, 2022 13:23
-
-
Save lsjostro/c0d6c74a066d5cf30fc56ba513bc32a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Summary: Create pyright config file in current directory | |
# | |
set -e | |
[ -n "$PYENV_DEBUG" ] && set -x | |
PYRIGHT_FILENAME='pyrightconfig.json' | |
create_new_file() { | |
new_file='{"venvPath":"'${VIRTUAL_ENV%/*}'", "venv":"'python-$PYENV_VERSION'"}' | |
echo "$new_file" >$PYRIGHT_FILENAME | |
} | |
if [ -n "$VIRTUAL_ENV" ] && [ -n "$PYENV_VERSION" ] && [ -n "$DIRENV_DIR" ]; then | |
create_new_file | |
exit 0 | |
else | |
echo "No virtualenv found. Please activate a virtualenv with pyenv and direnv." | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
install under
~/.pyenv/plugins/pyenv-pyright/bin/pyenv-pyright