Open augustobmoura opened 5 years ago
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)'
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)'
Similar to
rg
andfd
, 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