Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
a32a0d6ded
|
|||
|
9d8b924a30
|
|||
|
a5c0c2b011
|
|||
|
1061909d5b
|
|||
|
02648b8f83
|
|||
|
e97ae7ec2c
|
@@ -8,7 +8,7 @@ reset="\033[0m"
|
|||||||
KYMSU_PATH=`pwd`
|
KYMSU_PATH=`pwd`
|
||||||
|
|
||||||
# Make Kymsu accessible in PATH
|
# Make Kymsu accessible in PATH
|
||||||
echo -e "Installing ${bold}kymsu2${reset} in ${bold}/usr/local/bin${reset} ..."
|
echo -e "\nInstalling ${bold}kymsu2${reset} in ${bold}/usr/local/bin${reset} ..."
|
||||||
ln -fs "${KYMSU_PATH}"/kymsu2.sh /usr/local/bin/kymsu2
|
ln -fs "${KYMSU_PATH}"/kymsu2.sh /usr/local/bin/kymsu2
|
||||||
|
|
||||||
# Store Kymsu stuff in home directory
|
# Store Kymsu stuff in home directory
|
||||||
|
|||||||
@@ -15,8 +15,9 @@ display_info=true
|
|||||||
# Also add package for prevent to update whitout pin it.
|
# Also add package for prevent to update whitout pin it.
|
||||||
declare -a do_not_update=('')
|
declare -a do_not_update=('')
|
||||||
|
|
||||||
# No distract mode (no user interaction)(Casks with 'latest' version number won't be updated)
|
# No distract mode (no user interaction)
|
||||||
no_distract=false
|
[[ $@ =~ "--nodistract" ]] && no_distract=true || no_distract=false
|
||||||
|
|
||||||
#
|
#
|
||||||
###############################################################################################
|
###############################################################################################
|
||||||
#
|
#
|
||||||
@@ -26,6 +27,15 @@ no_distract=false
|
|||||||
#
|
#
|
||||||
###############################################################################################
|
###############################################################################################
|
||||||
|
|
||||||
|
italic="\033[3m"
|
||||||
|
underline="\033[4m"
|
||||||
|
ita_under="\033[3;4m"
|
||||||
|
bgd="\033[1;4;31m"
|
||||||
|
red="\033[1;31m"
|
||||||
|
bold="\033[1m"
|
||||||
|
box="\033[1;41m"
|
||||||
|
reset="\033[0m"
|
||||||
|
|
||||||
notification() {
|
notification() {
|
||||||
sound="Basso"
|
sound="Basso"
|
||||||
title="Antibody"
|
title="Antibody"
|
||||||
@@ -42,14 +52,12 @@ notification() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if [[ $1 == "--nodistract" ]]; then
|
|
||||||
no_distract=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e "\033[1m🙏 Antibody \033[0m"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
antibody_folder=$(antibody home)
|
antibody_folder=$(antibody home)
|
||||||
|
antibody_version=$(antibody -v 2>&1 | awk '{print $3}')
|
||||||
|
|
||||||
|
echo -e "${bold}🙏 Antibody ${reset}\n"
|
||||||
|
|
||||||
|
echo -e "Current ${underline}Antibody${reset} version: $antibody_version\n"
|
||||||
|
|
||||||
update=$(antibody update 2>&1)
|
update=$(antibody update 2>&1)
|
||||||
|
|
||||||
@@ -57,7 +65,7 @@ installed=$(echo "$update" | grep "updating")
|
|||||||
updated=$(echo "$update" | grep "updated")
|
updated=$(echo "$update" | grep "updated")
|
||||||
|
|
||||||
if [ -n "$installed" ]; then
|
if [ -n "$installed" ]; then
|
||||||
echo -e "\033[4mAntibody modules installed:\033[0m"
|
echo -e "${underline}Antibody modules installed:${reset}"
|
||||||
#echo "$installed"
|
#echo "$installed"
|
||||||
|
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
@@ -66,16 +74,18 @@ if [ -n "$installed" ]; then
|
|||||||
do
|
do
|
||||||
url=$(echo "$i" | awk '{print $3}')
|
url=$(echo "$i" | awk '{print $3}')
|
||||||
module=$(echo "$i" | awk -F "/" '{print $NF}')
|
module=$(echo "$i" | awk -F "/" '{print $NF}')
|
||||||
echo -e "\033[1m$module\033[0m ($url)"
|
echo -e "${bold}$module${reset} ($url)"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Modules are installed in $antibody_folder folder."
|
echo "Modules are installed in $antibody_folder folder."
|
||||||
else
|
else
|
||||||
echo -e "\033[4mNo Antibody modules installed.\033[0m"
|
echo -e "${underline}No Antibody modules installed.${reset}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
<<COMMENT
|
<<COMMENT
|
||||||
|
antibody update:
|
||||||
|
|
||||||
antibody: updating: https://github.com/zsh-users/zsh-history-substring-search
|
antibody: updating: https://github.com/zsh-users/zsh-history-substring-search
|
||||||
antibody: updating: https://github.com/zsh-users/zsh-completions
|
antibody: updating: https://github.com/zsh-users/zsh-completions
|
||||||
antibody: updating: https://github.com/zsh-users/zsh-autosuggestions
|
antibody: updating: https://github.com/zsh-users/zsh-autosuggestions
|
||||||
@@ -88,7 +98,7 @@ COMMENT
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
if [ -n "$updated" ]; then
|
if [ -n "$updated" ]; then
|
||||||
echo -e "\033[4mAntibody modules to update:\033[0m"
|
echo -e "${underline}Antibody modules to update:${reset}"
|
||||||
#echo "$updated"
|
#echo "$updated"
|
||||||
|
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
@@ -98,20 +108,18 @@ if [ -n "$updated" ]; then
|
|||||||
module=$(echo "$j" | awk -F "/" '{print $NF}' | awk '{print $1}')
|
module=$(echo "$j" | awk -F "/" '{print $NF}' | awk '{print $1}')
|
||||||
commit=$(echo "$j" | awk -F "$url" '{print $NF}')
|
commit=$(echo "$j" | awk -F "$url" '{print $NF}')
|
||||||
last_commit=$(echo "$commit" | awk '{print $NF}')
|
last_commit=$(echo "$commit" | awk '{print $NF}')
|
||||||
echo -e "\033[1m$module\033[0m ($url)"
|
echo -e "${bold}$module${reset} ($url)"
|
||||||
echo "Commits: $commit"
|
echo "Commits: $commit"
|
||||||
echo "Last commit: "$url"/commits/"$last_commit
|
echo "Last commit: "$url"/commits/"$last_commit
|
||||||
# https://github.com/zsh-users/zsh-completions/commits/
|
# https://github.com/zsh-users/zsh-completions/commits/
|
||||||
|
|
||||||
#notif="$module has been updated"
|
|
||||||
#notification "$notif"
|
|
||||||
modules+="$module "
|
modules+="$module "
|
||||||
done
|
done
|
||||||
notif="$modules has been updated"
|
notif="$modules has been updated"
|
||||||
notification "$notif"
|
notification "$notif"
|
||||||
|
|
||||||
else
|
else
|
||||||
echo -e "\033[4mNo Antibody modules to update.\033[0m"
|
echo -e "${underline}No Antibody modules to update.${reset}"
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -5,13 +5,20 @@
|
|||||||
# https://guides.rubygems.org/what-is-a-gem/
|
# https://guides.rubygems.org/what-is-a-gem/
|
||||||
|
|
||||||
# No distract mode
|
# No distract mode
|
||||||
no_distract=false
|
[[ $@ =~ "--nodistract" ]] && no_distract=true || no_distract=false
|
||||||
|
|
||||||
if [[ $1 == "--nodistract" ]]; then
|
italic="\033[3m"
|
||||||
no_distract=true
|
underline="\033[4m"
|
||||||
fi
|
ita_under="\033[3;4m"
|
||||||
|
bold="\033[1m"
|
||||||
|
bold_under="\033[1;4m"
|
||||||
|
redbox="\033[1;41m"
|
||||||
|
redbold="\033[1;31m"
|
||||||
|
red="\033[31m"
|
||||||
|
yellow="\033[33m"
|
||||||
|
reset="\033[0m"
|
||||||
|
|
||||||
echo -e "\033[1m 💍 Gem (Ruby) \033[0m"
|
echo -e "${bold} 💍 Gem (Ruby) ${reset}"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
@@ -21,7 +28,7 @@ upd=$(echo "$gem_outdated" | awk '{print $1}')
|
|||||||
if [ -n "$upd" ]; then
|
if [ -n "$upd" ]; then
|
||||||
nb=$(echo "$upd" | wc -w | xargs)
|
nb=$(echo "$upd" | wc -w | xargs)
|
||||||
|
|
||||||
echo -e "\\033[1;41m $nb \033[0m \033[4mavailables updates:\033[0m"
|
echo -e "${redbox} $nb ${reset} ${underline}availables updates:${reset}"
|
||||||
echo "$gem_outdated"
|
echo "$gem_outdated"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
@@ -38,5 +45,5 @@ if [ -n "$upd" ]; then
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
echo -e "\033[4mNo gem updates.\033[0m"
|
echo -e "${underline}No gem updates.${reset}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ display_info=true
|
|||||||
declare -a cask_to_not_update=()
|
declare -a cask_to_not_update=()
|
||||||
|
|
||||||
# No distract mode (no user interaction)(Casks with 'latest' version number won't be updated)
|
# No distract mode (no user interaction)(Casks with 'latest' version number won't be updated)
|
||||||
no_distract=false
|
[[ $@ =~ "--nodistract" ]] && no_distract=true || no_distract=false
|
||||||
|
|
||||||
# Some Casks have auto_updates true or version :latest. Homebrew Cask cannot track versions of those apps.
|
# Some Casks have auto_updates true or version :latest. Homebrew Cask cannot track versions of those apps.
|
||||||
# 'latest=true' force Homebrew to update those apps.
|
# 'latest=true' force Homebrew to update those apps.
|
||||||
@@ -59,9 +59,6 @@ notification() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $1 == "--nodistract" ]]; then no_distract=true; fi
|
|
||||||
if [[ $1 == "--latest" ]]; then latest=true; fi
|
|
||||||
|
|
||||||
get_info_cask() {
|
get_info_cask() {
|
||||||
info="$1"
|
info="$1"
|
||||||
app="$2"
|
app="$2"
|
||||||
@@ -129,7 +126,7 @@ get_info_pkg() {
|
|||||||
echo -e "${bold}🍺 Homebrew ${reset}"
|
echo -e "${bold}🍺 Homebrew ${reset}"
|
||||||
|
|
||||||
echo -e "\n🍺 ${underline}Updating brew...${reset}\n"
|
echo -e "\n🍺 ${underline}Updating brew...${reset}\n"
|
||||||
#brew update
|
brew update
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
brew_outdated=$(brew outdated --greedy --json=v2)
|
brew_outdated=$(brew outdated --greedy --json=v2)
|
||||||
@@ -204,7 +201,7 @@ echo -e "\n🍺 ${underline}Updating packages...${reset}\n"
|
|||||||
if [ -n "$upd_pkg_notpinned" ]; then
|
if [ -n "$upd_pkg_notpinned" ]; then
|
||||||
|
|
||||||
if [ "$no_distract" = false ]; then
|
if [ "$no_distract" = false ]; then
|
||||||
a=$(echo -e "Do you wanna run \033[1mbrew upgrade "$upd_pkg_notpinned"\033[0m ? (y/n/a) ")
|
a=$(echo -e "Do you wanna run ${bold}brew upgrade "$upd_pkg_notpinned"${reset} ? (y/n/a) ")
|
||||||
# yes/no/all
|
# yes/no/all
|
||||||
read -p "$a" choice
|
read -p "$a" choice
|
||||||
|
|
||||||
@@ -262,9 +259,9 @@ if (( ${#cask_to_not_update[@]} )); then
|
|||||||
|
|
||||||
nbp=${#cask_to_not_update[*]}
|
nbp=${#cask_to_not_update[*]}
|
||||||
|
|
||||||
echo -e "${underline}List of${reset} ${box} $nbp ${reset} ${underline}'do not update' packages:${reset}"
|
echo -e "${underline}List of${reset} ${box} $nbp ${reset} ${underline}'do not update' casks:${reset}"
|
||||||
echo -e "${red}${cask_to_not_update[*]}${reset}"
|
echo -e "${red}${cask_to_not_update[*]}${reset}"
|
||||||
echo -e "To remove package from this list, you need to edit the ${italic}do_not_update${reset} array."
|
echo -e "To remove an app from this list, you need to edit the ${italic}do_not_update${reset} array."
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
casks_not_pinned=""
|
casks_not_pinned=""
|
||||||
|
|||||||
@@ -3,16 +3,25 @@
|
|||||||
# Mac Appstore plugin for KYMSU
|
# Mac Appstore plugin for KYMSU
|
||||||
# https://github.com/welcoMattic/kymsu
|
# https://github.com/welcoMattic/kymsu
|
||||||
|
|
||||||
echo -e "\033[1m🍏 Mac App Store updates come fast as lightning \033[0m"
|
|
||||||
|
|
||||||
# No distract mode (no user interaction)
|
# No distract mode (no user interaction)
|
||||||
no_distract=false
|
[[ $@ =~ "--nodistract" ]] && no_distract=true || no_distract=false
|
||||||
|
|
||||||
if [[ $1 == "--nodistract" ]]; then
|
italic="\033[3m"
|
||||||
no_distract=true
|
underline="\033[4m"
|
||||||
fi
|
ita_under="\033[3;4m"
|
||||||
|
bold="\033[1m"
|
||||||
|
bold_under="\033[1;4m"
|
||||||
|
redbox="\033[1;41m"
|
||||||
|
redbold="\033[1;31m"
|
||||||
|
red="\033[31m"
|
||||||
|
yellow="\033[33m"
|
||||||
|
reset="\033[0m"
|
||||||
|
|
||||||
|
|
||||||
|
echo -e "${bold}🍏 Mac App Store updates come fast as lightning ${reset}"
|
||||||
|
|
||||||
|
echo -e "https://github.com/mas-cli/mas"
|
||||||
|
|
||||||
# https://github.com/mas-cli/mas
|
|
||||||
# On teste si mas est installé
|
# On teste si mas est installé
|
||||||
if hash mas 2>/dev/null; then
|
if hash mas 2>/dev/null; then
|
||||||
|
|
||||||
@@ -21,13 +30,13 @@ if hash mas 2>/dev/null; then
|
|||||||
echo "$massy"
|
echo "$massy"
|
||||||
|
|
||||||
if [ -n "$(mas outdated)" ]; then
|
if [ -n "$(mas outdated)" ]; then
|
||||||
echo -e "\033[4mAvailables updates:\033[0m"
|
echo -e "${underline}Availables updates:${reset}"
|
||||||
echo "$massy" | cut -d " " -f2-5
|
echo "$massy" | cut -d " " -f2-5
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
if [ "$no_distract" = false ]; then
|
if [ "$no_distract" = false ]; then
|
||||||
|
|
||||||
a=$(echo -e "Do you wanna run \033[1mmas upgrade\033[0m ? (y/n)")
|
a=$(echo -e "Do you wanna run \033[1mmas upgrade${reset} ? (y/n)")
|
||||||
read -pr "$a" choice
|
read -pr "$a" choice
|
||||||
case "$choice" in
|
case "$choice" in
|
||||||
y|Y|o ) mas upgrade;;
|
y|Y|o ) mas upgrade;;
|
||||||
@@ -40,10 +49,10 @@ if hash mas 2>/dev/null; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
echo -e "\033[4mNo availables mas updates.\033[0m"
|
echo -e "${italic}No availables mas updates.${reset}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Please install mas: brew install mas"
|
echo -e "Please install mas: ${italic}brew install mas${reset}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ display_info=true
|
|||||||
|
|
||||||
# No distract mode (no user interaction)
|
# No distract mode (no user interaction)
|
||||||
|
|
||||||
[[ $1 == "--nodistract" ]] && no_distract=true || no_distract=false
|
[[ $@ =~ "--nodistract" ]] && no_distract=true || no_distract=false
|
||||||
|
|
||||||
# Set ls_color to '' for output nvm list in default colors, else '--no-colors'
|
# Set ls_color to '' for output nvm list in default colors, else '--no-colors'
|
||||||
# ls_color='--no-colors'
|
# ls_color='--no-colors'
|
||||||
@@ -125,9 +125,9 @@ elif [ -f "/usr/local/opt/nvm/nvm.sh" ]; then
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\033[3mNote:"
|
echo -e "${italic}Note:"
|
||||||
echo -e "N/A: version \"10.18.0 -> N/A\" is not yet installed."
|
echo -e "N/A: version \"10.18.0 -> N/A\" is not yet installed."
|
||||||
echo -e "You need to run \"nvm install 10.18.0\" to install it before using it.\033[0m"
|
echo -e "You need to run \"nvm install 10.18.0\" to install it before using it.${reset}"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
@@ -154,9 +154,13 @@ if [ -d "$local_path" ]; then
|
|||||||
npm ls
|
npm ls
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
echo -e "\n${underline}🌿 Search for local packages update...${reset}\n"
|
||||||
outdated=$(npm outdated)
|
outdated=$(npm outdated)
|
||||||
if [ -n "$outdated" ]; then
|
if [ -n "$outdated" ]; then
|
||||||
|
|
||||||
|
echo -e "\n${underline}🌿 Updating local packages...${reset}\n"
|
||||||
|
|
||||||
if [ "$no_distract" = false ]; then
|
if [ "$no_distract" = false ]; then
|
||||||
#echo "$outdated"
|
#echo "$outdated"
|
||||||
echo "$outdated" | awk '{print $1}' | xargs -p -n 1 npm update
|
echo "$outdated" | awk '{print $1}' | xargs -p -n 1 npm update
|
||||||
@@ -166,7 +170,7 @@ if [ -d "$local_path" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
echo -e "\n${underline}No local packages updates.${reset}"
|
echo -e "${italic}No local packages updates.${reset}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -187,28 +191,45 @@ if [ "$display_info" = true ]; then
|
|||||||
echo -e "${bold}${line}${reset}"
|
echo -e "${bold}${line}${reset}"
|
||||||
else
|
else
|
||||||
echo -e "${line}"
|
echo -e "${line}"
|
||||||
fi
|
fi
|
||||||
done <<< "$lg"
|
done <<< "$lg"
|
||||||
else
|
else
|
||||||
npm list -g --depth=0
|
npm list -g --depth=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ========================================================================
|
|
||||||
# Tester npm outdated -g --long
|
|
||||||
|
|
||||||
g_outdated=$(npm outdated -g --parseable=true)
|
#Packages update
|
||||||
|
echo -e "\n${underline}🌿 Search for global packages update...${reset}\n"
|
||||||
|
|
||||||
echo "$g_outdated"
|
glong_outdated=$(npm outdated -g --long | sed '1d')
|
||||||
|
|
||||||
|
if [ -n "$glong_outdated" ]; then
|
||||||
|
echo -e "$glong_outdated\n"
|
||||||
|
echo -e "\n${underline}🌿 Updating global packages...${reset}\n"
|
||||||
|
|
||||||
|
while IFS= read -r line
|
||||||
|
do
|
||||||
|
pkg=$(echo "$line" | awk '{print $1}')
|
||||||
|
vers=$(echo "$line" | awk '{print $4}')
|
||||||
|
outdated="$pkg@$vers"
|
||||||
|
|
||||||
|
# TEST
|
||||||
|
version=$(echo "$line" | awk '{print $1 "@" $4}')
|
||||||
|
echo "$version"
|
||||||
|
# /test
|
||||||
|
|
||||||
|
if [ "$no_distract" = false ]; then
|
||||||
|
echo "$outdated" | xargs -p -n 1 npm -g install
|
||||||
|
echo ""
|
||||||
|
else
|
||||||
|
echo "$outdated" | xargs -n 1 npm -g install
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
done <<< "$glong_outdated"
|
||||||
|
|
||||||
# update -> wanted ; install -> latest
|
|
||||||
if [ -n "$g_outdated" ]; then
|
|
||||||
if [ "$no_distract" = false ]; then
|
|
||||||
echo "$g_outdated" | cut -d : -f 4 | xargs -p -n 1 npm -g install
|
|
||||||
else
|
|
||||||
echo "$g_outdated" | cut -d : -f 4 | xargs -n 1 npm -g install
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
echo -e "${underline}No global packages updates.${reset}"
|
echo -e "${italic}No global packages updates.${reset}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
@@ -218,11 +239,11 @@ echo ""
|
|||||||
###############
|
###############
|
||||||
|
|
||||||
if [ "$doctor" = true ]; then
|
if [ "$doctor" = true ]; then
|
||||||
echo "🌿 The Doc is checking that everything is ok."
|
echo -e "${underline}🌿 The Doc is checking that everything is ok.${reset}\n"
|
||||||
npm doctor
|
npm doctor
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
echo "🔍 Verifying npm cache"
|
echo -e "🔍 Verifying npm cache\n"
|
||||||
npm cache verify
|
npm cache verify
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -10,10 +10,19 @@
|
|||||||
# Settings:
|
# Settings:
|
||||||
|
|
||||||
# No distract mode (no user interaction)
|
# No distract mode (no user interaction)
|
||||||
no_distract=false
|
[[ $@ =~ "--nodistract" ]] && no_distract=true || no_distract=false
|
||||||
#
|
#
|
||||||
#########################################
|
#########################################
|
||||||
|
|
||||||
|
italic="\033[3m"
|
||||||
|
underline="\033[4m"
|
||||||
|
ita_under="\033[3;4m"
|
||||||
|
bgd="\033[1;4;31m"
|
||||||
|
red="\033[1;31m"
|
||||||
|
bold="\033[1m"
|
||||||
|
box="\033[1;41m"
|
||||||
|
reset="\033[0m"
|
||||||
|
|
||||||
notification() {
|
notification() {
|
||||||
sound="Basso"
|
sound="Basso"
|
||||||
title="Homebrew"
|
title="Homebrew"
|
||||||
@@ -27,15 +36,11 @@ notification() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if [[ $1 == "--nodistract" ]]; then
|
echo -e "${bold}🐘 pecl ${reset}"
|
||||||
no_distract=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e "\033[1m🐘 pecl \033[0m"
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
echo -e "\033[1m❗️ plugin en test (beta) \033[0m"
|
echo -e "${bold}❗️ plugin en test (beta) ${reset}"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# /usr/local/Cellar/php/7.4.11/bin/pecl
|
# /usr/local/Cellar/php/7.4.11/bin/pecl
|
||||||
@@ -60,7 +65,7 @@ pecl_upgrade=$($php_path/pecl list-upgrades)
|
|||||||
|
|
||||||
if [ -n "$pecl_upgrade" ]; then
|
if [ -n "$pecl_upgrade" ]; then
|
||||||
|
|
||||||
echo -e "\033[4mExtensions update:\033[0m"
|
echo -e "${underline}Extensions update:${reset}"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "$pecl_upgrade"
|
echo "$pecl_upgrade"
|
||||||
@@ -117,11 +122,11 @@ notif2="$conf_php was modified in the last 5 minutes"
|
|||||||
test=$(find "$dir" -name "$name" -mmin -5 -maxdepth 1)
|
test=$(find "$dir" -name "$name" -mmin -5 -maxdepth 1)
|
||||||
|
|
||||||
if [ -n "$test" ]; then
|
if [ -n "$test" ]; then
|
||||||
echo -e "\033[1;31m❗️ ️$notif2\033[0m"
|
echo -e "${red}❗️ ️$notif2${reset}"
|
||||||
notification "$notif2"
|
notification "$notif2"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
a=$(echo -e "Do you want to edit \033[1m$conf_php\033[0m file ? (y/n)")
|
a=$(echo -e "Do you want to edit ${bold}$conf_php${reset} file ? (y/n)")
|
||||||
read -p "$a" choice
|
read -p "$a" choice
|
||||||
if [ "$choice" == "y" ]; then
|
if [ "$choice" == "y" ]; then
|
||||||
$EDITOR "$conf_php"
|
$EDITOR "$conf_php"
|
||||||
|
|||||||
159
plugins.d/pip.sh
159
plugins.d/pip.sh
@@ -13,37 +13,47 @@
|
|||||||
#
|
#
|
||||||
# Settings:
|
# Settings:
|
||||||
|
|
||||||
|
# Display info on updated pakages / casks
|
||||||
|
#[[ $@ =~ "--info" ]] && display_info=false || display_info=true
|
||||||
|
display_info=true
|
||||||
|
|
||||||
|
# No distract mode (no user interaction)
|
||||||
|
[[ $@ =~ "--nodistract" ]] && no_distract=true || no_distract=false
|
||||||
|
|
||||||
|
# Display dependancies on updated pakages / casks
|
||||||
|
#[[ $@ =~ "--depend" ]] && display_depend=false || display_depend=true
|
||||||
|
display_depend=true
|
||||||
|
|
||||||
#version: pip ou pip3
|
#version: pip ou pip3
|
||||||
# pip: python3.8 - pip3: python3.9
|
# pip: python3.8 - pip3: python3.9
|
||||||
pip_version=pip3
|
pip_version=pip3
|
||||||
#user: "" or "--user"
|
#user: "" or "--user"
|
||||||
user=""
|
user=""
|
||||||
# No distract mode
|
|
||||||
no_distract=false
|
# Add module to the do_not_update array for prevent to update.
|
||||||
#add module to do_not_update array
|
|
||||||
#declare -a do_not_update=()
|
#declare -a do_not_update=()
|
||||||
#declare -a do_not_update=("parso" "asgiref")
|
#declare -a do_not_update=("parso" "asgiref")
|
||||||
declare -a do_not_update=("asgiref")
|
declare -a do_not_update=("asgiref")
|
||||||
#
|
#
|
||||||
#########################################
|
#########################################
|
||||||
|
|
||||||
|
: <<'END_COMMENT'
|
||||||
|
blabla
|
||||||
|
END_COMMENT
|
||||||
|
|
||||||
italic="\033[3m"
|
italic="\033[3m"
|
||||||
underline="\033[4m"
|
underline="\033[4m"
|
||||||
|
ita_under="\033[3;4m"
|
||||||
bold="\033[1m"
|
bold="\033[1m"
|
||||||
|
bold_under="\033[1;4m"
|
||||||
redbox="\033[1;41m"
|
redbox="\033[1;41m"
|
||||||
redbold="\033[1;31m"
|
redbold="\033[1;31m"
|
||||||
red="\033[31m"
|
red="\033[31m"
|
||||||
yellow="\033[33m"
|
yellow="\033[33m"
|
||||||
reset="\033[0m"
|
reset="\033[0m"
|
||||||
|
|
||||||
if [[ $1 == "--nodistract" ]]; then
|
command -v pipdeptree >/dev/null 2>&1 || { echo -e "You shoud intall ${bold}pipdeptree${reset} for checking packages dependancies ${italic}($pip_version install pipdeptree)${reset}.\n"; }
|
||||||
no_distract=true
|
command -v $pip_version >/dev/null 2>&1 || { echo -e "${bold}$pip_version${reset} is not installed." && exit 1; }
|
||||||
fi
|
|
||||||
|
|
||||||
if ! [ -x "$(command -v $pip_version)" ]; then
|
|
||||||
echo "Error: $pip_version is not installed." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e "${bold}🐍 $pip_version (Python 3) ${reset}"
|
echo -e "${bold}🐍 $pip_version (Python 3) ${reset}"
|
||||||
|
|
||||||
@@ -52,111 +62,108 @@ echo ""
|
|||||||
echo -e "Current ${underline}Python3${reset} version: $(python3 -V | awk '{print $2}')"
|
echo -e "Current ${underline}Python3${reset} version: $(python3 -V | awk '{print $2}')"
|
||||||
echo -e "Current ${underline}pip3${reset} version: $(pip3 -V)"
|
echo -e "Current ${underline}pip3${reset} version: $(pip3 -V)"
|
||||||
|
|
||||||
#$pip_version install --upgrade pip
|
#$pip_version install --upgrade pip > /dev/null
|
||||||
$pip_version install --upgrade pip > /dev/null
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
# Do not update casks
|
||||||
if (( ${#do_not_update[@]} )); then
|
if (( ${#do_not_update[@]} )); then
|
||||||
|
|
||||||
nbp=${#do_not_update[*]}
|
nbp=${#do_not_update[*]}
|
||||||
|
|
||||||
echo -e "${underline}List of${reset} ${redbox} $nbp ${reset} ${underline}'do not update' packages:${reset}"
|
echo -e "${underline}List of${reset} ${redbox} $nbp ${reset} ${underline}'do not update' packages:${reset}"
|
||||||
echo -e "${redbold}${do_not_update[*]}${reset}"
|
echo -e "${redbold}${do_not_update[*]}${reset}"
|
||||||
echo "To remove package from this list, you need to edit the do_not_update array."
|
echo -e "To remove package from this list, you need to edit the ${italic}do_not_update${reset} array."
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#Packages update
|
||||||
|
echo -e "🐍 ${underline}Search for packages update...${reset}\n"
|
||||||
|
|
||||||
pip_outdated=$($pip_version list --outdated --format columns)
|
pip_outdated=$($pip_version list --outdated --format columns)
|
||||||
upd=$(echo "$pip_outdated" | sed '1,2d' | awk '{print $1}')
|
upd=$(echo "$pip_outdated" | sed '1,2d' | awk '{print $1}')
|
||||||
|
#upd="asgiref CairoSVG setuptools"
|
||||||
|
|
||||||
|
# Find infos about updated packages
|
||||||
if [ -n "$upd" ]; then
|
if [ -n "$upd" ]; then
|
||||||
|
|
||||||
nb=$(echo "$upd" | wc -w | xargs)
|
nb=$(echo "$upd" | wc -w | xargs)
|
||||||
|
|
||||||
echo -e "${redbox} $nb ${reset} ${underline}availables updates:${reset}"
|
echo -e "${redbox} $nb ${reset} ${underline}availables updates:${reset}"
|
||||||
#echo $pip3_outdated_freeze | tr [:space:] '\n'
|
echo -e "\n$pip_outdated"
|
||||||
echo "$pip_outdated"
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
for i in $upd
|
for i in $upd
|
||||||
do
|
do
|
||||||
info=$($pip_version show "$i")
|
info=$($pip_version show "$i")
|
||||||
echo "$info" | head -4
|
|
||||||
echo ""
|
l=$(echo "$info" | sed -n '1p')
|
||||||
done
|
m=$(sed "1s/.*/\\${bold}$l\\${reset}/" <<< "$info")
|
||||||
|
echo -e "$m" | head -4
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
z+="$i "
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
if [ -x "$(command -v pipdeptree)" ]; then
|
# Check dependancies
|
||||||
echo -e "${underline}Check dependancies:${reset}"
|
if [ -x "$(command -v pipdeptree)" ] && [ "$display_depend" == true ]; then
|
||||||
echo "Be carefull!! This updates can be a dependancie for some modules. Check for any incompatible version."
|
|
||||||
fi
|
echo -e "🐍 ${underline}Check dependancies:${reset}\n"
|
||||||
echo ""
|
echo -e "Be carefull!! This updates can be a dependancie for some modules. Check for any incompatible version.\n"
|
||||||
for i in $upd
|
|
||||||
do
|
z=$(echo "$z" | sed 's/.$//' | sed 's/ /,/g')
|
||||||
if [ -x "$(command -v pipdeptree)" ]; then
|
dependencies=$(echo "$z" | xargs pipdeptree -r -p )
|
||||||
dependencies=$(echo "$i" | xargs pipdeptree -r -p | grep "$upd")
|
|
||||||
|
|
||||||
#asgiref==3.2.10
|
|
||||||
# - Django==3.1.2 [requires: asgiref~=3.2.10]
|
|
||||||
|
|
||||||
#parso==0.7.1
|
|
||||||
# - jedi==0.17.2 [requires: parso>=0.7.0,<0.8.0]
|
|
||||||
|
|
||||||
z=0
|
while IFS= read -r line; do
|
||||||
while read -r line; do
|
z=$(echo "${line}" | grep -i ^[a-z])
|
||||||
if [[ $line = *"<"* ]]; then
|
if [ -n "$z" ] ; then
|
||||||
echo -e "${red}$line${reset}"
|
echo -e "\n${bold}${line}${reset}"
|
||||||
elif [[ $line = *"~="* ]]; then
|
elif [[ "${line}" = *"<"* ]]; then
|
||||||
echo -e "${yellow}$line${reset}"
|
echo -e "${red}${line}${reset}"
|
||||||
else
|
elif [[ "${line}" = *"~="* ]]; then
|
||||||
if [ "$z" -eq 0 ]; then
|
echo -e "${yellow}${line}${reset}"
|
||||||
echo -e "${italic}$line${reset}"
|
|
||||||
else
|
|
||||||
echo "$line"
|
|
||||||
fi
|
|
||||||
z=$((z+1))
|
|
||||||
fi
|
|
||||||
done <<< "$dependencies"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
else
|
else
|
||||||
c=$(echo -e "Do you want to install pipdeptree to check dependancies ? (y/n)")
|
echo "${line}"
|
||||||
read -pr "$c" choice
|
|
||||||
case "$choice" in
|
|
||||||
y|Y|o ) $pip_version install $user pipdeptree ;;
|
|
||||||
n|N ) echo "Ok, let's continue";;
|
|
||||||
* ) echo "invalid";;
|
|
||||||
esac
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
done <<< "$dependencies"
|
||||||
# If the update is not in the do_not_update array, we install it.
|
|
||||||
|
fi
|
||||||
FOUND=`echo ${do_not_update[*]} | grep "$i"`
|
|
||||||
if [ "${FOUND}" = "" ] && [ "$no_distract" = false ]; then
|
|
||||||
|
# Updating packages
|
||||||
b=$(echo -e "Do you wanna run ${bold}$pip_version install $user --upgrade $i${reset} ? (y/n)")
|
echo -e "\n🐍 ${underline}Updating packages...${reset}\n"
|
||||||
|
|
||||||
|
[ "${#do_not_update[@]}" -gt 0 ] && echo -e "${redbold}Do not update: ${underline}${do_not_update[@]}${reset}${redbold} . It won't be updated!'${reset}\n"
|
||||||
|
|
||||||
|
for i in $upd
|
||||||
|
do
|
||||||
|
if [[ ! " ${do_not_update[@]} " =~ " ${i} " ]]; then
|
||||||
|
if [ "$no_distract" = false ]; then
|
||||||
|
|
||||||
|
b=$(echo -e "Do you wanna run ${bold}$pip_version install $user --upgrade $i${reset} ? (y/n)")
|
||||||
read -p "$b" choice
|
read -p "$b" choice
|
||||||
case "$choice" in
|
case "$choice" in
|
||||||
y|Y|o ) echo "$i" | xargs $pip_version install $user --upgrade ;;
|
y|Y|o ) echo "$i" | xargs $pip_version install $user --upgrade ;;
|
||||||
n|N ) echo "Ok, let's continue";;
|
n|N ) echo "Ok, let's continue";;
|
||||||
* ) echo "invalid";;
|
* ) echo "invalid";;
|
||||||
esac
|
esac
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
elif [ "${FOUND}" = "" ]; then
|
else
|
||||||
|
|
||||||
echo "$i" | xargs $pip_version install $user --upgrade
|
echo "$i" | xargs $pip_version install $user --upgrade
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
else
|
else
|
||||||
echo -e "${underline}No availables updates.${reset}"
|
echo -e "${underline}No availables updates.${reset}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "🐍 Running ${bold}pip check${reset} for checking that everything is ok."
|
echo -e "🐍 ${underline}Running ${reset}${bold_under}pip check${reset}${underline} for checking that everything is ok...${reset}\n"
|
||||||
|
|
||||||
$pip_version check
|
$pip_version check
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user