Created
November 12, 2015 07:58
-
-
Save abhiomkar/83cfb4ca95dc28b49cdb 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
pip3 () { | |
index=0 | |
PIP3_ARGS=( "$@" ) | |
for i in "$@" | |
do | |
if [[ $i == "install" || $i == "uninstall" ]] | |
then | |
echo "install/uninstall opt found" | |
PIP3_INSTALL_FLAG=1 | |
elif [[ $i == "init" ]] | |
then | |
mkvirtualenv --python=`which python3` $(basename $PWD) && touch .pip3-init && workon $(basename $PWD) | |
exit 0 | |
elif [[ $i == "--save" ]] | |
then | |
echo "save opt found" | |
PIP3_SAVE_FLAG=1 | |
unset PIP3_ARGS[$index] | |
fi | |
let index++ | |
done | |
if [[ $PIP3_INSTALL_FLAG == 1 && $PIP3_SAVE_FLAG == 1 ]] | |
then | |
$PIP3 ${PIP3_ARGS[@]} && $PIP3 freeze > requirements.txt | |
else | |
$PIP3 $* | |
fi | |
} | |
# returns error on ZSH | |
# pip3: no matches found: PIP3_ARGS[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment