1
0
Fork 0
mirror of synced 2024-05-24 11:10:30 -04:00

Fix with failed updates

This commit is contained in:
AtomicCoding 2018-04-16 19:45:52 -07:00
parent a7844c8284
commit 7aecb170b6
No known key found for this signature in database
GPG key ID: D9C2E2ED3C4516FA

View file

@ -3,17 +3,18 @@ local updated=0
local failed=0 local failed=0
local module local module
local mlocation local mlocation
local nfailed
local ncolors red green yelllow blue bold normal local ncolors red green yelllow blue bold normal
if which tput >/dev/null 2>&1; then if which tput >/dev/null 2>&1; then
ncolors=$(tput colors) ncolors=$(tput colors)
fi fi
if [ -t 1 ] && [ -n "${ncolors}" ] && [ "${ncolors}" -ge 8 ]; then if [ -t 1 ] && [ -n "${ncolors}" ] && [ "${ncolors}" -ge 8 ]; then
red=$(tput setaf 1) red="$(tput setaf 1)"
green=$(tput setaf 2) green="$(tput setaf 2)"
yellow=$(tput setaf 3) yellow="$(tput setaf 3)"
blue=$(tput setaf 4) blue="$(tput setaf 4)"
bold=$(tput bold) bold="$(tput bold)"
normal=$(tput sgr0) normal="$(tput sgr0)"
else else
red="" red=""
green="" green=""
@ -23,6 +24,7 @@ else
normal="" normal=""
fi fi
for module in $umodules; do for module in $umodules; do
nfailed=0
if [ -d ${ZIM_HOME}/modules/${module} ]; then if [ -d ${ZIM_HOME}/modules/${module} ]; then
mlocation=${ZIM_HOME}/modules/${module} mlocation=${ZIM_HOME}/modules/${module}
elif [ -d ${ZIM_HOME}/modules/prompt/external-themes/${module} ]; then elif [ -d ${ZIM_HOME}/modules/prompt/external-themes/${module} ]; then
@ -36,13 +38,16 @@ for module in $umodules; do
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo -ne "${red}Failed to update $module...\n $output $normal"\\r echo -ne "${red}Failed to update $module...\n $output $normal"\\r
failed=$((failed+1)) failed=$((failed+1))
nfailed=1
fi fi
if ! [ ${nfailed} = "1" ]; then
if echo "$output" | grep -i "up to date" > /dev/null; then if echo "$output" | grep -i "up to date" > /dev/null; then
echo -ne "${blue}$module at latest version. $normal"\\r echo -ne "${blue}$module at latest version. $normal"\\r
else else
echo -ne "${green}Updated $module! $normal"\\r echo -ne "${green}Updated $module! $normal"\\r
updated=$((updated+1)) updated=$((updated+1))
fi fi
fi
printf '\n' printf '\n'
done done
for pmodule in $pmodules; do for pmodule in $pmodules; do