Created
December 17, 2019 14:30
-
-
Save nv1t/37cbaa3ec88dca123fa9801aff5a3b11 to your computer and use it in GitHub Desktop.
I work with pipenv a lot. Sometimes a delete or move a directory and forget to delete the virtualenv and so it lingers around in .local. this is a small wrapper to delete all the orphaned virtualenv directories :)
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
function rmvirtualenv() { | |
for i in ~/.local/share/virtualenvs/*/.project; do | |
venv=$(dirname "${i}") | |
directory=$(cat "${i}") | |
echo "${venv}" | |
if [ -d "${directory}" ] && [ -f "${directory}/Pipfile" ]; then | |
echo -n "[+] " | |
else | |
echo -n "[-] " | |
rm -r "${venv}" | |
fi | |
echo "${directory}" | |
echo | |
done; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment