-
-
Notifications
You must be signed in to change notification settings - Fork 817
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 --exclude option. #89
Comments
Yes this can certainly help with integrations along with CLI convenience. I was hoping to integrate fd with my Vim file find plugin Vim-Quickly. rg and ag file search allow for exclusion options which lets me exclude Vim's "wildignore" patterns. I don't really want to integrate something that will frustrate users by not ignoring "wildignore", so I'll hold off until this is implemented. Just one plugin isn't a big deal, but others looking to integrate with fd might have the same needs and this would be helpful for them. |
@tmccombs Thank you for writing this up. Sounds good to me. Seems like the I was previously thinking about adding an |
I think |
Also see the (😛 I can turn |
Just a thought, a feature mentioned in the README is fd is 50% shorter than find, using |
I would prefer |
I think |
I'm not picky about the name. But I do think it would be inconvenient to have to edit a temporary file to temporarily ignore files. |
I agree that the rule/glob can specify whether the file should be included or excluded. What comes to the naming, I think I feel the discussion about EDIT: Oh, but we already have |
Yes. I'm also in favor of keeping this in sync with ripgrep. Let's implement this as
Agreed. As you said, this is already supported to a certain extent (by creating a
Yes. That is a bit unfortunate. #97 is a discussion / feature request to add |
@Detegr Yeah, #97 implement the (near) traditional globbing mode in posix shells. A different thing. My first thought about About the case-sensitivity of this flag (of whatever name), I don't know if smart case should apply when it is just temporary. I can imagine that I use the auto-complete function of the shell to get the directory name, then turn it into a rule. Then |
* Add `--exclude`/`-E` option. * Support for multiple exclude patterns Example: ``` bash > fd --exclude 'tests/**/*.rs' mod src/exec/mod.rs src/fshelper/mod.rs src/lscolors/mod.rs ``` Closes #89
* Add `--exclude`/`-E` option. * Support for multiple exclude patterns Example: ``` bash > fd --exclude 'tests/**/*.rs' mod src/exec/mod.rs src/fshelper/mod.rs src/lscolors/mod.rs ``` Closes #89
* Add `--exclude`/`-E` option. * Support for multiple exclude patterns Example: ``` bash > fd --exclude 'tests/**/*.rs' mod src/exec/mod.rs src/fshelper/mod.rs src/lscolors/mod.rs ``` Closes #89
* Add `--exclude`/`-E` option. * Support for multiple exclude patterns Example: ``` bash > fd --exclude 'tests/**/*.rs' mod src/exec/mod.rs src/fshelper/mod.rs src/lscolors/mod.rs ``` Closes #89
This is now supported (see #148) |
Add an --exclude option which takes a .gitignore style pattern to exclude from the search (the option can be specified multiple times to add multiple excludes).
Maybe also consider a complementary --include option.
Implementation
The argument(s) would be added to the WalkBuilder with the
overrides
method, with a "!" prepended so they are exclusions, not inclusions. Alternatively, write the arguments to a temporary file and useadd_ignore
. (It may be worth adding a PR toignore
to add an easier way to add exclude globs to overrides).The text was updated successfully, but these errors were encountered: