mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
[GH-ISSUE #173] Match sub-directories or allow globs/regexs with --ignore-directory
#77
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @andreavaccari on GitHub (Sep 2, 2021).
Original GitHub issue: https://github.com/bootandy/dust/issues/173
Hi, thank you for your work on
dust. This is a suggestion for improvement. The--ignore-directoryflag currently does not match subdirectories. This would be very helpful, for example, to analyze a directory containing many repos, each containing directories to ignore:dust -f -X .git -X node_modules ~/dir-with-many-repos.Possible improvements are:
**/node_modules) or regexs (.*/node_modules$).The latter is more complex but more flexible, and would make it so only one flag could/should be specified.
Unfortunately I'm not familiar with Rust. I hope you'll consider implementing this in the future. Thank you!
@bootandy commented on GitHub (Sep 2, 2021):
So just so I understand running:
dust -X node_modules ~/dir-with-many-repos.You would like it to ignore ~/dir-with-many-repos/a/node_modules and ~/dir-with-many-repos/other_dir/sub_dir/node_modules ?
I think the above makes sense, but I'd prefer to do it with globs or regexs as in your second suggestion.
I'll add it to the todo list and I'll look at implementing it.
@andreavaccari commented on GitHub (Sep 3, 2021):
Yes, your example matches my suggestion.
At the moment, to exclude the two directories in your example you would have to run:
dust -X a/node_modules -X other_dir/sub_dir/node_modules ~/dir-with-many-reposIf you had several directories, you'd have to use
find -execorxargs. Being able to do this withdustalone would be great!@bootandy commented on GitHub (Sep 5, 2021):
I have just (accidentally) created this feature with this commit https://github.com/bootandy/dust/pull/174/commits/1d1bada2e402714b2c77900496616f4bca49dd5f
It will mimic the
grep -v regexbehaviour. Which will allow you to dodust -v node_modulesThe commit isn't released yet.
@bootandy commented on GitHub (Sep 19, 2021):
Fixed with version 0.7
@andreavaccari commented on GitHub (Oct 1, 2021):
Hi @bootandy, I wanted to confirm that the
-voption helped tremendously with my use case.Could you clarify the following when you have a moment?
-eand-v, is it possible to match a pattern against a candidate's relative path instead of just its filename?-e, it's possible to declare multiple patterns. With-v, only the first pattern takes effect. Is this intended?Thank you!
@bootandy commented on GitHub (Oct 11, 2021):
@andreavaccari
No, that appears to be a bug I'll look into that: https://github.com/bootandy/dust/issues/188
I hadn't considered relative paths when writing this. I'm not currently sure if that is possible. I'll look into it.