git-updater/progress_info.sh

46 lines
668 B
Bash
Raw Normal View History

2018-02-12 00:01:01 +01:00
#!/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"
}