#!/usr/bin/env bash # ============================================================================= # lib/output.sh # Terminal output helpers: colors, log levels, and step banners. # ============================================================================= if [[ -t 1 ]]; then GREEN='\033[0;32m' YELLOW='\033[1;33m' CYAN='\033[0;36m' RED='\033[0;31m' BOLD='\033[1m' NC='\033[0m' else GREEN='' YELLOW='' CYAN='' RED='' BOLD='' NC='' fi info() { echo -e "${CYAN}[INFO]${NC} $*"; } success() { echo -e "${GREEN}[OK]${NC} $*"; } warn() { echo -e "${YELLOW}[WARN]${NC} $*"; } error() { echo -e "${RED}[ERROR]${NC} $*" >&2; } step() { echo -e "\n${BOLD}${YELLOW}━━━ $* ━━━${NC}"; } box() { local max_len=0 for line in "$@"; do [[ ${#line} -gt $max_len ]] && max_len=${#line} done local border border=$(printf '─%.0s' $(seq 1 $((max_len + 2)))) echo -e "${CYAN}┌${border}┐${NC}" for line in "$@"; do printf "${CYAN}│${NC} %-${max_len}s ${CYAN}│${NC}\n" "$line" done echo -e "${CYAN}└${border}┘${NC}" }