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

Do not emit color or line wrapping controls when stdout is not a terminal #61

Open
jwodder opened this issue Jul 24, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@jwodder
Copy link

jwodder commented Jul 24, 2024

When pfetch is invoked in an environment in which stdout is not a terminal (e.g., when piping the program's output to another program), then color sequences should not be emitted (unless some explicit "force color" option is given), and the crossterm sequences for disabling & enabling line wrapping should not be emitted either.

FYI, you can test whether stdout is a terminal using the std::io::IsTerminal trait introduced in Rust 1.70.

@Gobidev Gobidev added the enhancement New feature or request label Jul 25, 2024
@Gobidev
Copy link
Owner

Gobidev commented Jul 25, 2024

then color sequences should not be emitted (unless some explicit "force color" option is given)

PF_COLOR=1 might be a good option for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants