]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve 'emake --quieter'
authorGregory Heytings <gregory@heytings.org>
Wed, 16 Aug 2023 17:46:16 +0000 (17:46 +0000)
committerGregory Heytings <gregory@heytings.org>
Wed, 16 Aug 2023 17:47:34 +0000 (17:47 +0000)
* admin/emake: Improve the output when the --quieter option is
used.

admin/emake

index 2badbe8035829e4811b4a371d003a13423098a68..c9e59d340672496a212da4d9f8474662858028e7 100755 (executable)
@@ -138,14 +138,20 @@ The GNU allocators don't work|\
 while read
 do
     C=""
-    (($NOCOLOR == 0)) && [[ "X${REPLY:0:1}" != "X " ]] && C="\033[1;31m"
-    (($NOCOLOR == 0)) && [[ "X${REPLY:0:3}" == "X   " ]] && C="\033[1;31m"
+    E=0
+    [ ! -v L ] && L=80
+    [[ "X${REPLY:0:1}" != "X " ]] && E=1
+    [[ "X${REPLY:0:3}" == "X   " ]] && E=1
+    (($NOCOLOR == 0)) && (($E == 1)) && C="\033[1;31m"
+    (($NOCOLOR == 0)) && (($E == 1)) && C="\033[1;31m"
     if (($QUIETER == 0))
     then
-       [[ "X$C" == "X" ]] && printf "%s\n" "$REPLY" || printf "$C%s\033[0m\n" "$REPLY"
+       (($E == 0)) && printf "%s\n" "$REPLY" || printf "${C}%s\033[0m\n" "$REPLY"
     else
-       [[ "X$C" == "X" ]] && printf "%-80s\r" "$REPLY" || printf "$C%-80s\033[0m\n" "$REPLY"
+       (($E == 0)) && printf "%-${L}s\r" "$REPLY" || printf "${C}%-${L}s\033[0m\n" "$REPLY"
     fi
+    L=${#REPLY}
+    (($L < 80)) && L=80
 done
 
 # If make failed, exit now with its error code.