Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use is-terminal crate to mimic exact ls output even with flags when being piped. #527

Closed
Oglo12 opened this issue Oct 12, 2023 · 4 comments · Fixed by #534
Closed

Comments

@Oglo12
Copy link

Oglo12 commented Oct 12, 2023

There is a big problem! So, I use eza --icons as my ls alias, and often times I want to grep something from ls, or pipe the ls output into something like fzf, the problem is that the icons and colors are included. I have found a way to solve this though:

https://crates.io/crates/is-terminal

This crate allows you to tell various things, such as, is the output of the command being piped into another program?
Bat (a cat replacement), does this. It has fancy output when just being used as is, but when you pipe bat into grep for example, it produces the same exact output as cat.

image

@PThorpe92
Copy link
Member

There is actually a very old but open PR that fixes this. Needed a reminder to look into it again 👍

@cafkafk
Copy link
Member

cafkafk commented Oct 13, 2023

#438 might also be used as inspiration for a solution

@cafkafk
Copy link
Member

cafkafk commented Oct 13, 2023

Actually, what version of eza are you on?

@Delapouite
Copy link

Also, as noted on the readme of the crate, this is not a builtin trait of the Rust std lib : https://doc.rust-lang.org/stable/std/io/trait.IsTerminal.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment