Module Fmt_tty
Fmt
TTY setup.
Fmt_tty
provides simple automatic setup on channel formatters for:
Fmt.set_style_renderer
.`Ansi_tty
is used if the channel is a tty and the environment variableTERM
is defined and its value is not"dumb"
.`None
is used otherwise.Fmt.set_utf_8
.true
is used if one of the following environment variables has"UTF-8"
as a case insensitive substring:LANG
,LC_ALL
,LC_CTYPE
.
TTY setup
val setup : ?style_renderer:Fmt.style_renderer -> ?utf_8:bool -> Stdlib.out_channel -> Stdlib.Format.formatter
setup ?style_renderer ?utf_8 outc
is a formatter foroutc
withFmt.set_style_renderer
andFmt.set_utf_8
correctly setup. Ifstyle_renderer
orutf_8
are specified they override the automatic setup.If
outc
isstdout
,Fmt.stdout
is returned. Ifoutc
isstderr
,Fmt.stderr
is returned.
val setup_std_outputs : ?style_renderer:Fmt.style_renderer -> ?utf_8:bool -> unit -> unit
setup_std_outputs ?style_renderer ?utf_8 ()
appliessetup
onstdout
andstderr
.