Open griffi-gh opened 2 years ago
This boils down to detecting whether the current environment is a terminal (TTY) that supports ANSI codes, which probably requires a helper dependency crate to do that for us.
I did some quick research:
atty
or crossterm
return true
when querying "is a TTY?" while running in any Windows terminal I tried (CMD.exe, Terminal, VSCode embedded term), so don't give the right info (admittedly, because this is the wrong question; but mentioning anyway for completeness).ansi_term
allow manipulating colors, but already assume that ANSI codes are supported, so are of no use (mentioning because ansi_term
is quite popular).enable-ansi-support
crate, which tries to enable ANSI code support on Windows (this is no-op on other platforms since they all support it), and returns an error code if it fails; this gives us 2 nice things:
What problem does this solve or what need does it fill?
ANSI Escape sequences make logs unreadable in cmd
What solution would you like?
Either disable ASII escape codes for cmd or use the Windows CMD-specific ones
What alternative(s) have you considered?
N/A
Additional context