Color output based on LSCOLORS#84
Conversation
|
Hi @meain, Brace yourself because it's not an easy one. I was thinking about this issue since a moment and it would be super cool if we success to contains all the lscolor logic inside the What do you think of it? |
|
How about something like style_for_path_with_metadata whose signature looks like pub fn style_for_path_with_metadata<P: AsRef<Path>>(
&self,
path: P,
metadata: Option<&std::fs::Metadata>,
) -> Option<&Style> {}but instead of metadata we pass in the type which is an |
|
Seems cool. I think you can simplify the function a little more by replacing the |
|
Even after a successful build, There's an unhandled exception in this merge. OS: Arch Linux |
|
@Peltoche I was trying to get the colouring working with the new |
|
Hi @Skarlett , this bug should be fixed into the recent after the 0.11.0. If you keep having the bug with a later version can you create an issue please? |
|
Hi @meain. It seems that the extension feature will be difficult to implement for now because for what I have seen the lscolor package doesn't support it neither. What do you think about implementing a more basic implementation (without the extensions) for now and then improving it later? |
If you mean the |
Yessir, you can count on that. |
Arf, my bad... If the filename is required in order to make a correct implementation let's go for it then. |
|
@Peltoche I am not sure about the approach that I want to use for this. This is what I have come up for now. We will retain the There will be some recomputation as to the type of the file but this seems like a simple way to approach this for now. Do you have any other idea as to how to approach this? Also I think we should restrict the other colors to 1 to 15. This will help to have the colors based on the colorscheme |
|
This is the first draft, see if it looks good. @Peltoche |
Peltoche
left a comment
There was a problem hiding this comment.
It look cool, I think that a fallback on Self::colorize would be great.
a398f5b to
28d50d3
Compare
|
@Peltoche The build on travis seems to fails as it cannot compile |
|
@meain I guess we are forced to drop the 1.30 and align ourselve with the rust 2018 edition... I make a PR which should solve it. |
Peltoche
left a comment
There was a problem hiding this comment.
It's almost good! There is just some that we can simplify a little.
1cf2e92 to
79ad656
Compare
|
Do we merge it? |
Added another enum value to Theme `NoLscolors`. As of right now it only helps with tests, but maybe useful for something in future. Colouring based on LSCOLORS should be tested in the package so we should be good.
|
Yeah, I guess this is good to merge now. |
Uses https://github.com/sharkdp/lscolors to color the output.
Fixes #28
LSCOLOR? I thinkexadoes something like that.