1
0
mirror of https://git.decapod.one/brethil/dotfiles synced 2024-11-25 04:51:31 +01:00

functions: update pipupdate

This commit is contained in:
bretello 2020-11-13 13:26:19 +01:00
parent c91c1bfb10
commit 6211d8711c

View File

@ -223,13 +223,32 @@ fi
### end of mac-specific functions
function pipupdate(){
for pip in pip2 pip3; do
if [ -z $pip ]; then
continue
pipupdate(){
set -x
if [[ "$1" == "user" ]]; then
user_flags='--user'
shift
fi
$pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 $pip install -U
if [[ -n "$@" ]]; then
pip="$1"
shift
flags="$*"
echo "pip command is: '$pip $flags'"
if ! command -v "$pip" ; then
echo "Given command ($1) does not exist." 1>&2
return
fi
else
pip='python'
flags='-m pip'
echo "Using default pip: $pip $flags"
fi
for package in $($pip $flags freeze $user_flags --local | grep -v '^\-e' | cut -d = -f 1) ; do
$pip $flags install "$user_flags" -U "$package"
done
set +x
}
# unzip file to directory with the same name of the zip file (without extension)