git-updater/progress_info.sh
2018-02-12 00:01:01 +01:00

45 lines
668 B
Bash
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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"
}