Commit initial
This commit is contained in:
commit
c782f282b0
2 changed files with 57 additions and 0 deletions
45
progress_info.sh
Normal file
45
progress_info.sh
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Après avoir inclu ce fichier, on peut l'utiliser ainsi :
|
||||||
|
# progress_start "Attente de 5 secondes"
|
||||||
|
# sleep 5
|
||||||
|
# progress_end " OK " green
|
||||||
|
# progress_start "Attente pour l'éternité"
|
||||||
|
# sleep 3
|
||||||
|
# progress_end "FAIL" red "Attente terminée trop tôt !"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
set_color() {
|
||||||
|
case $1 in
|
||||||
|
red)
|
||||||
|
echo -ne "\e[31m";;
|
||||||
|
green)
|
||||||
|
echo -ne "\e[32m";;
|
||||||
|
yellow)
|
||||||
|
echo -ne "\e[33m";;
|
||||||
|
blue)
|
||||||
|
echo -ne "\e[34m";;
|
||||||
|
magenta)
|
||||||
|
echo -ne "\e[35m";;
|
||||||
|
cyan)
|
||||||
|
echo -ne "\e[36m";;
|
||||||
|
*)
|
||||||
|
echo -ne "\e[0m";;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
progress_start() {
|
||||||
|
echo -ne "[ ] $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
progress_end() {
|
||||||
|
set_color
|
||||||
|
echo -ne "\r["
|
||||||
|
set_color $2
|
||||||
|
echo -n "$1"
|
||||||
|
set_color
|
||||||
|
echo "] $3"
|
||||||
|
}
|
||||||
|
|
12
update.sh
Executable file
12
update.sh
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source progress_info.sh
|
||||||
|
|
||||||
|
for rep in *
|
||||||
|
do
|
||||||
|
progress_start "\e[1;37m$rep\e[0m"
|
||||||
|
[[ ! -d $rep/.git ]] && progress_end "SKIP" green && continue
|
||||||
|
cd $rep
|
||||||
|
output=$(git pull 2>&1) && progress_end " OK " green "$(echo -e "\e[1;37m$rep\e[0m\n$output" | sed 'N;s/\n/\n /g;P;D')" || progress_end "FAIL" red "$(echo -e "\e[1;37m$rep\e[0m\n$output" | sed 'N;s/\n/\n /g;P;D')"
|
||||||
|
cd - &>/dev/null
|
||||||
|
done
|
Loading…
Reference in a new issue