"message.lib: Evo : L'option -color est prise en compte uniquement dans un terminal"

This commit is contained in:
Doug Le Tough 2018-08-12 18:30:37 +02:00
parent f8f3e1879f
commit 7b23238e51
2 changed files with 17 additions and 14 deletions

View File

@ -60,6 +60,7 @@
# 1.3.5 31-08-2017 - Emmanuel Confrere - Ano : Introduction d une autre ano ! # 1.3.5 31-08-2017 - Emmanuel Confrere - Ano : Introduction d une autre ano !
# Format de sortie modifier (ajout systematique d un espace) # Format de sortie modifier (ajout systematique d un espace)
# 1.3.6 26-11-2017 - Doug Le Tough - Evo : Horodatage des logs au format YYYYMMDD HH:MM:SS # 1.3.6 26-11-2017 - Doug Le Tough - Evo : Horodatage des logs au format YYYYMMDD HH:MM:SS
# 1.3.7 12-08-2018 - Doug Le Tough - Evo : L'option -color est prise en compte uniquement dans un terminal
##---------------------------------------------------------------------------- ##----------------------------------------------------------------------------
function fct_message function fct_message
@ -94,19 +95,21 @@ do
"-cpt") L_OPTION_CPT=1 ;; "-cpt") L_OPTION_CPT=1 ;;
"-nolog") L_OPTION_NOLOG=1 ;; "-nolog") L_OPTION_NOLOG=1 ;;
"-hist") L_OPTION_HIST=1 ;; "-hist") L_OPTION_HIST=1 ;;
"-color") L_OPTION_COULEUR=1 "-color") if [ ${TERM} != 'dumb' ] && [ ${TERM} != 'unknown' ] && [ ${#TERM} -gt 0 ]; then
L_ARG=`echo $2|tr A-Z a-z` # Display color for terminal only
L_TMP2=${L_ARG:0:1} L_OPTION_COULEUR=1
if [ "${L_TMP2}" != "-" ] L_ARG=`echo $2|tr A-Z a-z`
then L_TMP2=${L_ARG:0:1}
# on recherche la correspondance numerique de la couleur if [ "${L_TMP2}" != "-" ]
L_COULEUR=`echo ${L_LIST_COULEUR}|sed "s/.*${L_ARG}:\([0-1];3[0-7]\) .*/\1/"` then
# Si on ne la trouve pas on annule la colorisation # on recherche la correspondance numerique de la couleur
[ ${#L_COULEUR} -ne 4 ] && L_OPTION_COULEUR=0 L_COULEUR=`echo ${L_LIST_COULEUR}|sed "s/.*${L_ARG}:\([0-1];3[0-7]\) .*/\1/"`
L_TMP=$(( ${L_TMP} + 1 )) # Si on ne la trouve pas on annule la colorisation
shift [ ${#L_COULEUR} -ne 4 ] && L_OPTION_COULEUR=0
fi ;; L_TMP=$(( ${L_TMP} + 1 ))
shift
fi
fi;;
"-debug") L_OPTION_DBG=1 "-debug") L_OPTION_DBG=1
L_ARG="$2" L_ARG="$2"
L_TMP2=${L_ARG:0:1} L_TMP2=${L_ARG:0:1}

View File

@ -378,7 +378,7 @@ then
eval L_NB_ARG=\$\(\( \${#${L_VAR}[*]} - ${L_PARAM_ARGS_DEF} \)\) eval L_NB_ARG=\$\(\( \${#${L_VAR}[*]} - ${L_PARAM_ARGS_DEF} \)\)
(( ${L_PARAM_ARGS_DEF} )) && (( L_PARAM_ARGS_DEF-- )) (( ${L_PARAM_ARGS_DEF} )) && (( L_PARAM_ARGS_DEF-- ))
# -- Si pas encore initialise alors la taille est 0 # -- Si pas encore initialise alors la taille est 0
(( ${L_NB_ARG} )) && eval ${L_VAR}[${L_NB_ARG}]=${L_VAL} || eval ${L_VAR}=${L_VAL} (( ${L_NB_ARG} )) && eval ${L_VAR}[${L_NB_ARG}]=${L_VAL} || eval ${L_VAR}=${L_VAL}
else else
# -- Pas de declaration !! # -- Pas de declaration !!
(( ! ${#L_ERREUR_MSG[11]} )) && L_ERREUR_MSG[11]="L argument suivant a ete dectecte sans declaration : " (( ! ${#L_ERREUR_MSG[11]} )) && L_ERREUR_MSG[11]="L argument suivant a ete dectecte sans declaration : "