You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From time to time it happens to me that I forget to supply a regex-pattern when using an explicit search path. In particular, this happens when I use --extension EXT/-e EXT because it feels like EXT is a pattern by itself:
> fd -e jpg /share/pictures # this will not do what you expect
The right way would be to use fd -e jpg . /share/pictures or fd -e jpg "" /share/pictures.
Instead, what the command above will try to do is to search for files in the current directory that match the regular expression /share/pictures (there will be none). I was wondering whether we could detect such cases and warn the user.
A possible implementation could look like this:
If all of the following conditions are fulfilled:
only a single argument is given (which fd normally interprets as a search pattern)
the pattern contains a path-separation character (/ or \)
(the pattern is an existing path in the filesystem)
--full-path/-p has not been enabled (otherwise, we could potentially find entries that match the pattern)
... print a warning:
The search pattern "/share/pictures" looks like a path. If you want to specify a
root directory, use an empty search pattern: `fd [options] "" /share/pictures`.
The text was updated successfully, but these errors were encountered:
From time to time it happens to me that I forget to supply a regex-pattern when using an explicit search path. In particular, this happens when I use
--extension EXT
/-e EXT
because it feels likeEXT
is a pattern by itself:The right way would be to use
fd -e jpg . /share/pictures
orfd -e jpg "" /share/pictures
.Instead, what the command above will try to do is to search for files in the current directory that match the regular expression
/share/pictures
(there will be none). I was wondering whether we could detect such cases and warn the user.A possible implementation could look like this:
If all of the following conditions are fulfilled:
/
or\
)--full-path
/-p
has not been enabled (otherwise, we could potentially find entries that match the pattern)... print a warning:
The text was updated successfully, but these errors were encountered: