Ajout du mode no_distract
This commit is contained in:
2018-07-23 06:59:35 +02:00
parent fd4797aa7e
commit 0b719dc88f

20
_pip.sh
View File

@@ -7,12 +7,18 @@
version=pip3
#user: "" or "--user"
user=""
# No distract mode
no_distract=false
#add module to do_not_update array
declare -a do_not_update=( "tornado")
declare -a do_not_update=( "tornado","urllib3")
if [[ $1 == "nodistract" ]]; then
no_distract=true
fi
if ! [ -x "$(command -v $version)" ]; then
echo "Error: $version is not installed." >&2
exit 1
echo "Error: $version is not installed." >&2
exit 1
fi
echo ""
@@ -56,10 +62,10 @@ if [ -n "$upd" ]; then
done <<< "$dependencies"
fi
# si la m-à-j n'est pas dans le tableau do_not_update, on propose de l'installer
# If the update is not in the do_not_update array, we install it.
FOUND=`echo ${do_not_update[*]} | grep "$i"`
if [ "${FOUND}" = "" ]; then
if [ "${FOUND}" = "" ] && [ "$no_distract" = false ]; then
b=$(echo -e "Do you wanna run \033[1m$version install $user --upgrade "$i"\033[0m ? (y/n)")
read -p "$b" choice
@@ -70,6 +76,10 @@ if [ -n "$upd" ]; then
esac
echo ""
elif [ "${FOUND}" = "" ]; then
echo $i | xargs $version install $user --upgrade
fi
done