better display implementation

This commit is contained in:
Geoffray Levasseur-Brandin
2025-06-19 14:47:14 +02:00
parent b08e457146
commit f0f80e2924

View File

@@ -41,6 +41,7 @@
export DEFAULTFG="\e[0;39m" export DEFAULTFG="\e[0;39m"
export DEFAULTBG="\e[0;49m" export DEFAULTBG="\e[0;49m"
export DEFAULTCOL=${DEFAULTBG}${DEFAULTFG} export DEFAULTCOL=${DEFAULTBG}${DEFAULTFG}
export RESETCOL=$'\e[0m'
# Regular Colors # Regular Colors
export Black='\e[0;30m' export Black='\e[0;30m'
@@ -121,31 +122,31 @@ disp()
"I") "I")
local heads="[ ${IGreen}info${DEFAULTFG} ]" local heads="[ ${IGreen}info${DEFAULTFG} ]"
shift shift
[[ -z $QUIET || $QUIET -ne 1 ]] && echo -e "${heads} $@" [[ -z $QUIET || $QUIET -ne 1 ]] && \
printf "%b\n" "${heads} $*${RESETCOL}"
;; ;;
"W") "W")
local heads="[ ${IYellow}Warning${DEFAULTFG} ]" local heads="[ ${IYellow}Warning${DEFAULTFG} ]"
shift shift
echo -e "${heads} $@" >&2 printf "%b\n" "${heads} $*${RESETCOL}" >&2
;; ;;
"E") "E")
local heads="[ ${IRed}ERROR${DEFAULTFG} ]" local heads="[ ${IRed}ERROR${DEFAULTFG} ]"
shift shift
echo -e "${heads} $@" >&2 printf "%b\n" "${heads} $*${RESETCOL}" >&2
;; ;;
"D") "D")
local heads"[ ${ICyan}debug${DEFAULTFG} ]" local heads="[ ${ICyan}debug${DEFAULTFG} ]"
shift shift
[[ -n $DEBUG && $DEBUG -gt 1 ]] && echo -e "${heads} $@" [[ -n $DEBUG && $DEBUG -gt 1 ]] && \
printf "%b\n" "${heads} $*${RESETCOL}"
;; ;;
"*") * )
local heads="" [[ -z $QUIET || $QUIET -ne 1 ]] && \
[[ -z $QUIET || $QUIET -ne 1 ]] && echo -e "$@" printf "%b\n" "$*"
;; ;;
esac esac
unset heads
} }
export -f disp export -f disp
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# EOF # EOF