Created
April 4, 2023 23:30
-
-
Save gregorypease280/1ee8af205021ab1322dcf9cce2fc0124 to your computer and use it in GitHub Desktop.
zed venv config
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
#Gets the current venv path and creates the pyrightconfig for zed | |
#activate your venv then run it | |
cofig_file_name="pyrightconfig.json" | |
current_venv="${current_venv:-$(basename ${VIRTUAL_ENV})}" | |
current_venv_path="${current_venv_path:-$(builtin cd ${VIRTUAL_ENV}; pwd)}" | |
project_path="${project_path:-./}" | |
config_path="${project_path}${cofig_file_name}" | |
config_venv="${config_venv:-${current_venv}}" | |
config_venv_path="${config_venv_path:-${current_venv_path}}" | |
config_json='{"venvPath": "'${config_venv}'", "venv": "'${config_venv_path}'"}' | |
echo "Creating ${config_path} with venv: ${config_venv} and venv_path: ${config_venv_path}" | |
if test -f "$config_path"; then | |
read -p "Overwrite? y/n " -n 1 -r | |
echo | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
echo "${config_path} exists... overwriting to: ${config_json}" | |
echo $config_json > $config_path | |
fi | |
else | |
touch $config_path | |
echo $config_json > $config_path | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment