"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 19:18:09 +02:00
parent 7b23238e51
commit d015b989ad
1 changed files with 15 additions and 14 deletions

View File

@ -95,20 +95,21 @@ do
"-cpt") L_OPTION_CPT=1 ;;
"-nolog") L_OPTION_NOLOG=1 ;;
"-hist") L_OPTION_HIST=1 ;;
"-color") if [ ${TERM} != 'dumb' ] && [ ${TERM} != 'unknown' ] && [ ${#TERM} -gt 0 ]; then
# Display color for terminal only
L_OPTION_COULEUR=1
L_ARG=`echo $2|tr A-Z a-z`
L_TMP2=${L_ARG:0:1}
if [ "${L_TMP2}" != "-" ]
then
# on recherche la correspondance numerique de la couleur
L_COULEUR=`echo ${L_LIST_COULEUR}|sed "s/.*${L_ARG}:\([0-1];3[0-7]\) .*/\1/"`
# Si on ne la trouve pas on annule la colorisation
[ ${#L_COULEUR} -ne 4 ] && L_OPTION_COULEUR=0
L_TMP=$(( ${L_TMP} + 1 ))
shift
fi
"-color") L_OPTION_COULEUR=1
L_ARG=`echo $2|tr A-Z a-z`
L_TMP2=${L_ARG:0:1}
if [ "${L_TMP2}" != "-" ]
then
# on recherche la correspondance numerique de la couleur
L_COULEUR=`echo ${L_LIST_COULEUR}|sed "s/.*${L_ARG}:\([0-1];3[0-7]\) .*/\1/"`
# Si on ne la trouve pas on annule la colorisation
[ ${#L_COULEUR} -ne 4 ] && L_OPTION_COULEUR=0
L_TMP=$(( ${L_TMP} + 1 ))
shift
fi
if [ ${TERM} == 'dumb' ] || [ ${TERM} == 'unknown' ] || [ ${#TERM} -eq 0 ]; then
# Affiche les couleurs uniquement dans un terminal
L_OPTION_COULEUR=0
fi;;
"-debug") L_OPTION_DBG=1
L_ARG="$2"