From 6f7aec9147e3c78c8ca17b686e219d0954b30e41 Mon Sep 17 00:00:00 2001 From: Xavier Logerais Date: Fri, 21 Nov 2025 19:44:12 +0000 Subject: [PATCH] feat(libs): Improve colors lib --- libs/colors.bash | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/libs/colors.bash b/libs/colors.bash index abbef67..a6f87ec 100755 --- a/libs/colors.bash +++ b/libs/colors.bash @@ -58,11 +58,23 @@ function echo_reverse { echo -e "\e[7m${*}\e[0m"; } function echo_concealed { echo -e "\e[8m${*}\e[0m"; } # Affiche un message informatif stylisé sur la sortie d'erreur -function echo_info { >&2 echo -e "\e[00;34;49m󰋼 ${*}\e[39;49;00m"; } -function echo_warning { >&2 echo -e "\e[00;33;49m ${*}\e[39;49;00m"; } -function echo_error { >&2 echo -e "\e[00;01;31;49m ${*}\e[39;49;00m"; } -function echo_success { >&2 echo -e "\e[00;01;32;49m ${*}\e[39;49;00m"; } -function echo_failed { >&2 echo -e "\e[00;01;31;49m✖ ${*}\e[39;49;00m"; } +function echo_info { >&2 echo -e "\e[00;34;49m󰋼 ${*}\e[39;49;00m"; } +function echo_warning { >&2 echo -e "\e[00;33;49m ${*}\e[39;49;00m"; } +function echo_error { >&2 echo -e "\e[00;01;31;49m ${*}\e[39;49;00m"; } +function echo_success { >&2 echo -e "\e[00;01;32;49m ${*}\e[39;49;00m"; } +function echo_failed { >&2 echo -e "\e[00;01;31;49m✖ ${*}\e[39;49;00m"; } + +function echo_verbose { + if [ -n "${VERBOSE}" ]; then + echo_faint "${*}" >&2 + fi +} + +function echo_debug { + if [ -n "${DEBUG}" ]; then + echo_faint "🐛 ${*}" >&2 + fi +} function echo_demo { echo_bold bold @@ -77,4 +89,5 @@ function echo_demo { echo_error error echo_success success echo_failed failed + DEBUG=true echo_debug debug }