bids-validator
bids-validator copied to clipboard
do not add ANSI coloring if stdout is not a tty -- add `--color=auto,yes,no`
It has bugged me for a while, even with original bids-validator and now with deno version: if output is redirected to a file we still get ANSI characters in there which makes viewing requiring special options to less (-R) or otherwise looks horrid:
relates to
- #829
I think by default (with auto
), if output is not a tty - there should be no color. Deducing if stdout is tty should be easy, in python like this
❯ python -c 'import sys; print(sys.stdout.isatty(), file=sys.stderr)'
True
❯ python -c 'import sys; print(sys.stdout.isatty(), file=sys.stderr)' > /dev/null
False