walles / moar

Moar is a pager. It's designed to just do the right thing without any configuration.
Other
674 stars 19 forks source link

`moar --colors=8 > output.txt` doesn't write colors #207

Closed timotheecour closed 1 week ago

timotheecour commented 6 months ago

in most programs (eg rg, yq, less etc), there's an option to write colors even if output is redirected (to stdout or a file etc). Can we either honor the flag --colors=8 when specified, or add a flag --usecolors=yes|no|auto to specify whether coloring should be used (yes would force regardless of stdout redirection, auto would depend on whether stdout is redirected)

I use moar because it just works for syntax highlight (eg use case where other tools fail: https://github.com/mikefarah/yq/issues/1162#issuecomment-2086923873) but now am facing the issue that it doesn't work if I need to redirect it somehow

walles commented 6 months ago

What is the less command line option for it to force color when redirecting output?

I find that unexpected for a pager, especially less which doesn't do any coloring that I'm aware of, so a concrete example would be super!

walles commented 1 week ago

@timotheecour if you still want this, feel free to re-open with more info!