-
-
Notifications
You must be signed in to change notification settings - Fork 798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --glob/-g option for glob-based search #284
Comments
Just discovered fd, after years of find. While I found it great initially, when I discovered that globbing isn't supported that was the first "meh" moment. For the implementation...wouldn't it be easier to tread it more like a fixed string but call fnmatch(3) on the filenames instead of plain string comparison (I know Rust too little to tell)? fnmatch(3) is the standard function that bash and find use for globbing. |
Pedantic, but I doubt bash uses |
The implementation I suggested is probably the easiest one, given how I would guess that the glob-matching semantics are the same, so I would hope that there is no drawback in choosing the "globs via regexes" route. |
Released in v7.4.0. |
A glob-based search (in addition to the default regex-based search) has been requested a few times (see #97, #157). I think we should consider to add this.
A few things to consider are:
--case-sensitive
and--ignore-case
should work as expected--fixed-strings
,--full-path
,--extension
)Implementation-wise, we would probably just create a regex from the glob-pattern (glob syntax: https://docs.rs/globset/0.3.0/globset/#syntax). Also, we should enable "dot-all", just like in #111. Note that there is a (possible outdated) implementation here: #96. If nothing else, we should definitely looks at the extensive tests.
Note: a
--regex
option could be an optional extension to override--glob
(if someone wants toalias fd="fd --glob"
, for example).The text was updated successfully, but these errors were encountered: