Lsd: Option to filter VCS ignored files

Created on 23 May 2019  Â·  5Comments  Â·  Source: Peltoche/lsd

Similar to rg and fd, add a option to ignore paths in .gitignore, .ignore, .svnignore etc. It's really useful with the --tree option (maybe it should be active by default?)

We can use https://crates.io/crates/ignore as the mentionated libaries. I might make a pull-request about it this weekend, should be easy to plug the ignore lib in

kinenhancement

Most helpful comment

I don't think having it active by default is a good idea as it might conflict with people who wanna use lsd as an alternative to ls. But having this feature under a flag would be awesome.

All 5 comments

Hi @augustobmoura ,

It seems a cool feature indeed. You PR will be welcomed!

I don't think having it active by default is a good idea as it might conflict with people who wanna use lsd as an alternative to ls. But having this feature under a flag would be awesome.

Turns out that the implementation is not as easy as I imagined (it's like a habit to me). The ignore crate works with a custom path walker and customs structs for representing files and directories, so probably we will need to rewrite a lot of code. I don't have much time to work on it, and probably a regular maintainer should be responsible for a refactor of this scale

Looking forward into this feature, as sometimes I want to list the tree but want to ignore the node_modules folder.

Is it feasible now that @sumitsahrawat dropped #275? It'd also be helpful to pass --ignore-file to my alias like fd too. ripgrep's ignore crate provides a lot of that out of the box. My workaround is:

alias tree='lsd --tree $(xargs printf " --ignore-glob=%s" < $IGNORE_FILE/ignore)'
Was this page helpful?
0 / 5 - 0 ratings

Related issues

Berrysoft picture Berrysoft  Â·  3Comments

ABSphreak picture ABSphreak  Â·  8Comments

spencerwooo picture spencerwooo  Â·  3Comments

ngirard picture ngirard  Â·  6Comments

jfernandz picture jfernandz  Â·  6Comments