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

Add --files-without-matches flag. #239

Merged
merged 1 commit into from
Nov 20, 2016

Conversation

mernen
Copy link
Contributor

@mernen mernen commented Nov 20, 2016

Performs the opposite of --files-with-matches: only shows paths of files that contain zero matches.

Closes #138.


This is a rather quick-and-dirty patch: I had zero familiarity with the codebase, and I basically searched for files.with.matches to guide me where changes should be made. I've tried to match the overall code style, but I may have missed something.

Performs the opposite of --files-with-matches: only shows paths of
files that contain zero matches.

Closes BurntSushi#138
@@ -1059,6 +1067,16 @@ sherlock!(feature_89_files_with_matches, "Sherlock", ".",
});

// See: https://github.com/BurntSushi/ripgrep/issues/89
sherlock!(feature_89_files_without_matches, "Sherlock", ".",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should say feature_138.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually meant issue #89, since the test is about the interaction between --null and this feature.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see, missed that. Sounds good!

@BurntSushi
Copy link
Owner

This looks awesome, thank you! I had one little nit but this otherwise looks good to go!

@BurntSushi BurntSushi merged commit 61663e2 into BurntSushi:master Nov 20, 2016
@BurntSushi
Copy link
Owner

Thanks!

@BurntSushi
Copy link
Owner

After playing with this, I realized that the equivalent option in grep is --files-without-match instead of --files-without-matches. That's my bad. I'll fix that!

@BurntSushi
Copy link
Owner

Done in 03f7605

@mernen
Copy link
Contributor Author

mernen commented Nov 20, 2016

Oops, my bad! Every other tool uses --files-without-matches, and I never bothered to check grep. Wouldn't it be better to also rename functions and fields, though?

@BurntSushi
Copy link
Owner

@mernen No worries, it's totally my fault since I didn't check grep either until just now! It's unfortunate that other tools diverge, but I tend to give grep the highest precedence with this sort of thing because of its ubiquity.

I'm not too picky about the names in the code. There doesn't really need to be a precise correspondence between the CLI flags and the struct fields, so we can take liberties to make them more consistent. Moreover, much of that search code is going to get moved into a separate crate eventually, which will pretty firmly divorce it from whatever CLI interface ripgrep puts in front of it.

@mernen mernen mentioned this pull request Jan 8, 2017
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.

2 participants