Closed Vedaant-Rajoo closed 9 months ago
Perhaps it's worth supporting NO_COLOR
too while we're here? Or I could do it as a separate PR to streamline this one.
NO_COLOR
is an informal standard/convention to disable color in command-line application output. It's usually implemented in color libraries, but since we don't use one we'd be responsible for doing it directly.
If NO_COLOR
is set to any non-empty string, all colors are disabled.
Perhaps it's worth supporting
NO_COLOR
too while we're here? Or I could do it as a separate PR to streamline this one.
NO_COLOR
is an informal standard/convention to disable color in command-line application output. It's usually implemented in color libraries, but since we don't use one we'd be responsible for doing it directly.If
NO_COLOR
is set to any non-empty string, all colors are disabled.
Agreed, feel free to modify the PR.
I've added a commit, feedback welcome.
NO_COLOR
is set, don't display color unless overridden otherwise.NO_COLOR
is not set.An issue I noticed with the branch though, it seems ./tldr -C tldr
doesn't work though?
./tldr: unrecognized option '-C'
The long option works flawlessly, but before adding my commit, the short option wasn't working, I did not resolve this. 🤔
n issue I noticed with the branch though, it seems
./tldr -C tldr
doesn't work though?./tldr: unrecognized option '-C'
The long option works flawlessly, but before adding my commit, the short option wasn't working, I did not resolve this. 🤔
Interesting, I will try replicating this.
Update: Tested it right now, the force colour option works fine for me before your commit too.
I think this PR is GTG will merge it and focus on the other PR updating the man page.
What does it do?
Disable color display when the output is not a tty.
Why the change?
Color gives weird ANSI polluted output for non tty screens.
tldr
is used not only in terminals but other places like code editors like vim and emacs where this behaviour might not be simplified.How can this be tested?
tldr tldr > tldr.md
tldr --color tldr > tldr.md
tldr tldr
Where to start code review?
parser.c
Relevant tickets?
closes #35
Questions?
<Ask us anything!>