Pádraig Brady wrote:
> You could determine that programatically with something like:
>
> if os.system(r'{ tput bold || tput md; } >/dev/null 2>&1') == 0:
> # enable bold output
Thanks for the hint, but this way of doing introduces more complexity.
There are basically 4 situations regarding TERM:
(A) The terminal supports the ANSI escapes for bold 94%
and TERM's name starts with 'xterm'.
(B) The terminal supports the ANSI escapes for bold 3%
and TERM's name is something else (e.g. 'linux' etc.)
(C) The terminal supports some other escapes for bold. 1%
(E.g. vt52)
(D) The terminal does not support bold. 2%
(E.g. emacs with TERM=dumb.)
The gnulib-tool code captures only the situation (A), i.e. uses bold face
only for 94% of the users, but the escape sequence is correct always.
What you propose captures the situations (A)+(B)+(C), i.e. uses bold face
for 98% of the users, but requires `tput bold` and `tput sgr0`, otherwise
we produce wrong output in case (C).
Bruno