[plugins/pip] Add shortcut for upgrading pip outdated packages.

This commit is contained in:
shunyi 2015-09-01 13:44:09 +08:00
commit 2bdca4978f

View file

@ -76,3 +76,23 @@ zsh-pip-test-clean-packages() {
echo "the djangopypi2 index is fine"
fi
}
zsh-pip-upgrade-installed-packages() {
outdated_packages=`pip list -o 2>/dev/null`
if [[ -n $outdated_packages ]] ; then
echo "Outdated packages:"
echo -e "$outdated_packages\n"
echo -e "Start upgrading...\n"
echo $outdated_packages | awk {'print $1'} | xargs pip install -U
echo -e "\nAll installed packages are up to date."
else
echo "No outdated packages."
fi
}
pip-upgrade() {
zsh-pip-upgrade-installed-packages
}