Skip to content
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

Warn when forgetting --hidden on a filename starting with . #1588

Open
jannikschaper opened this issue Jul 10, 2024 · 2 comments
Open

Warn when forgetting --hidden on a filename starting with . #1588

jannikschaper opened this issue Jul 10, 2024 · 2 comments

Comments

@jannikschaper
Copy link

First time fd user, just took 3 minutes to figure out why fd won't find my .eslintrc.js file; see shell history:

fd
fdfind
fdfind .eslintrc.js
fdfind *.eslintrc.js
fdfind \*.eslintrc.js
fdfind \.*\.eslintrc\.js
fdfind --globl "*.eslintrc.js"
fdfind --glob "*.eslintrc.js"
fdfind --glob "**/*.eslintrc.js"
fdfind | grep ".eslintrc.js"
cd ci
fdfind
fdfind -a
fdfina --help
fdfind --help
fdfind --hidden .eslintrc.js

Yes it's a rookie mistake, but it also wouldn't hurt anyone I think if fdfind detected this mistake and wrote a heads-up message to stderr :)

Specifically: when a pattern is specified where any possible match would be implicitly filtered out, for example by the implicit --no-hidden, or others, if there are more cases like this

@tavianator
Copy link
Collaborator

The main complication is that patterns are regular expressions by default, where . means "any character" not "a dot". The expressions are also unanchored, meaning your .eslintrc.js pattern would match Aeslintrc.js.gz, foo.eslintrc.js, etc. I think warning every time the first pattern char is . would be too much. We could warn on

fd '^\.foo'

@jannikschaper
Copy link
Author

Yes, definitely, that's what I meant

And fd --glob .foo should get a warning too, because --glob also seems to anchor to the filename start

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants