walles / moar

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

No color in Powershell when using pipes #245

Closed cmust closed 3 weeks ago

cmust commented 2 months ago

Running this command

dir | moar

produces an output with no color.

The equivalent command (ls | moar) in other shells preserves the coloring as expected.

walles commented 2 months ago

I think the reason you're getting color from ls in this case is that you have some configuration enforcing color.

If you want color from dir you need to somehow get dir to color output not only to terminals but to pipes as well.

In GNU ls, you do this by passing --color=always. On BSD ls, setting CLICOLOR_FORCE to some value will force color.

What I expect, and what's probably happening with Powershell is this:

Do you get color from env -i /bin/ls | moar? If not, this demonstrates that you're somehow forcing ls to show color even when piping its output to somewhere else.

walles commented 3 weeks ago

No response, closing.

@cmust do re-open as needed!