Skip to content

Conversation

mgorny
Copy link

@mgorny mgorny commented Aug 31, 2025

Make sure to override crossterm module's NO_COLOR autodetection with our color flag, so that --color=... option correctly overrides the value of NO_COLOR in the environment.

Fixes #1159


TODO

  • Use cargo fmt
  • Add necessary tests
  • Update default config/theme in README (if applicable)
  • Update man page at lsd/doc/lsd.md (if applicable)

Make sure to override crossterm module's `NO_COLOR` autodetection
with our color flag, so that `--color=...` option correctly overrides
the value of `NO_COLOR` in the environment.

Fixes lsd-rs#1159

Signed-off-by: Michał Górny <[email protected]>
@mgorny mgorny requested a review from zwpaper as a code owner August 31, 2025 14:26
@mgorny
Copy link
Author

mgorny commented Aug 31, 2025

I'm sorry but I don't really understand the meaning of the "TODO" checkboxes. Am I supposed to check them if I have done the relevant bit, or if I haven't done them, so they are "to be done"?

@zwpaper
Copy link
Member

zwpaper commented Aug 31, 2025

hi @mgorny, never mind the checkboxes, it's for making sure you updated the docs and did tests.

can you confirm that this change working as expected when piping result into other commands or files

@mgorny
Copy link
Author

mgorny commented Aug 31, 2025

can you confirm that this change working as expected when piping result into other commands or files

I think so.

./target/debug/lsd | cat → no colors
./target/debug/lsd --color=auto | cat → no colors
./target/debug/lsd --color=always | cat → colors

(same behavior as ls).

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

Successfully merging this pull request may close these issues.

--color=always not respected with NO_COLOR=1 (incorrect implementation)
2 participants