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