33800 Docs

← Retour
#!/bin/bash # =========================================== # Couleurs et formatage pour les scripts # =========================================== # Couleurs export RED='\033[0;31m' export GREEN='\033[0;32m' export YELLOW='\033[1;33m' export BLUE='\033[0;34m' export PURPLE='\033[0;35m' export CYAN='\033[0;36m' export WHITE='\033[1;37m' export NC='\033[0m' # No Color # Styles export BOLD='\033[1m' export DIM='\033[2m' export UNDERLINE='\033[4m' # Fonctions de log log_info() { echo -e "${GREEN}[INFO]${NC} $1" } log_warn() { echo -e "${YELLOW}[WARN]${NC} $1" } log_error() { echo -e "${RED}[ERROR]${NC} $1" } log_success() { echo -e "${GREEN}[✓]${NC} $1" } log_step() { echo -e "${CYAN}[STEP]${NC} $1" } log_debug() { if [ "$DEBUG" = "true" ]; then echo -e "${DIM}[DEBUG] $1${NC}" fi } # Séparateurs print_separator() { echo -e "${DIM}────────────────────────────────────────────────────────────${NC}" } print_header() { echo "" echo -e "${BOLD}${CYAN}$1${NC}" print_separator } # Spinner pour les opérations longues spinner() { local pid=$1 local delay=0.1 local spinstr='|/-\' while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do local temp=${spinstr#?} printf " [%c] " "$spinstr" local spinstr=$temp${spinstr%"$temp"} sleep $delay printf "\b\b\b\b\b\b" done printf " \b\b\b\b" }