lsd icon indicating copy to clipboard operation
lsd copied to clipboard

Option to filter VCS ignored files

Open augustobmoura opened this issue 6 years ago • 6 comments

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

augustobmoura avatar May 23 '19 12:05 augustobmoura

Hi @augustobmoura ,

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

Peltoche avatar May 23 '19 13:05 Peltoche

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.

meain avatar May 24 '19 06:05 meain

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

augustobmoura avatar Jun 10 '19 21:06 augustobmoura

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

sangdth avatar Jul 06 '19 14:07 sangdth

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)'

texastoland avatar Apr 20 '20 07:04 texastoland

Here is mine:

alias lt='lsd --tree $(IGNORE=$(git rev-parse --show-toplevel)/.gitignore; if [ -f "$IGNORE" ]; then xargs printf " --ignore-glob=%s" < "$IGNORE"; fi)'

jrd avatar Aug 17 '23 09:08 jrd