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

Allow specifying patterns with -f FILE and -f- #227

Merged
merged 1 commit into from
Nov 15, 2016

Conversation

emk
Copy link
Contributor

@emk emk commented Nov 9, 2016

This is a somewhat basic implementation of -f- (#7), with unit tests, just to start a discussion. Your suggestions are very welcome, of course!

Changes include:

  1. The internals of the pattern function have been refactored to avoid code duplication, but there's a lot more we could do. Right now we read the entire pattern list into a Vec.
  2. There's now a WorkDir::pipe command that allows sending standard input to rg when testing.

Not yet implemented: aho-corasick, or any kind of sensible support for other extremely large inputs.

Thank you for helping me get this far, and for any further suggestions!

@BurntSushi
Copy link
Owner

@emk This looks superb! I think this is good to go as is after a rebase (sorry about that, did some bug fixing last night).

This is a somewhat basic implementation of `-f-` (BurntSushi#7), with unit tests.
Changes include:

1. The internals of the `pattern` function have been refactored to avoid
   code duplication, but there's a lot more we could do.  Right now we
   read the entire pattern list into a `Vec`.
2. There's now a `WorkDir::pipe` command that allows sending standard
   input to `rg` when testing.

Not implemented: aho-corasick.
@emk
Copy link
Contributor Author

emk commented Nov 15, 2016

As requested, I've rebased this onto master! Thank you for helping me figure out what needed to happen.

@BurntSushi
Copy link
Owner

All right, let's do this! I'll merge this one before #233 to save you some pain.

I don't have a release plan written down right now, but my vague thoughts are to get this, #233 and another PR fixing various color bugs merged before putting out a 0.3 release.

@BurntSushi BurntSushi merged commit 39e1a0d into BurntSushi:master Nov 15, 2016
@BurntSushi
Copy link
Owner

Thank you!

@BurntSushi
Copy link
Owner

@emk Just a heads up, in the process of rebasing #233 I found one thing that I didn't consider during review that I just went ahead and fixed. Specifically, we should permit multiple uses of -f/--file in combination with multiple uses of -e/--regexp.

@ravron
Copy link

ravron commented Jan 27, 2017

Hey @BurntSushi, just a reminder that you may want to update your blog post, which says in part:

ripgrep doesn’t yet support searching for patterns/literals from a file, but this is easy to add and should change soon.

@BurntSushi
Copy link
Owner

@ravron Thanks for the reminder! Updated. :-)

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

Successfully merging this pull request may close these issues.

3 participants