Closed REALERvolker1 closed 10 months ago
Thank you very much for your contribution. I rebased to fix some CI issues and did a minor rewrite of the unit test — hope that's fine with you.
Regarding the lscolors
binary, let's discuss potential changes in the two issues you linked above. I'm certainly open to that.
@sharkdp it would be great if the option existed in the binary.
Best would be to color normally if the file exists (executable bit, ...) or just color it according to the extension otherwise.
Can you please open a new issue with a proposal on how we would change the CLI (if necessary)?
This pull request adds a function,
LsColors::style_for_str()
that retrieves the correct suffix style for any string.It would provide a workaround for both #70 and #78, they would just have to verify that the file exists before colorizing it. Or, they could just colorize it, because that would work too.
It's pretty simple anyways. I decided not to implement this in
bin.rs
because I did not know if you want that or not.Let me know if I need to revise anything. I tried to keep changes minimal, and this was literally the second rust
#[test]
I've ever written.