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

Feature request: --files-without-matches #138

Closed
mernen opened this issue Sep 30, 2016 · 7 comments
Closed

Feature request: --files-without-matches #138

mernen opened this issue Sep 30, 2016 · 7 comments
Labels
enhancement An enhancement to the functionality of the software.

Comments

@mernen
Copy link
Contributor

mernen commented Sep 30, 2016

One flag that occasionally comes useful is to identify files that don't match a certain expression. Both ag and ack have -L/--files-without-matches (effectively the opposite of -l/--files-with-matches).

One minor problem here is that rg -L is already taken for following symlinks.

Curiously, ag -lv appears to be a synonym of -L. I'm not sure whether this is intentional or not, but it seems like a perfectly reasonable approach to me — in fact, years ago, before I knew of -L, this is actually what I first tried with ack, and got bogus results (it interprets this combo as "list all files that have at least one line that does not match the given expression", like ripgrep does today). Personally, I don't think I've ever had a use case for this.

@BurntSushi BurntSushi added the enhancement An enhancement to the functionality of the software. label Sep 30, 2016
@BurntSushi
Copy link
Owner

I'm not opposed to adding --files-without-matches, but I don't think we need to add a short alias for it. I'd at least like to keep -L for following symlinks.

I'm also not opposed to making -v a bit smarter with respect to whether -l is given or not, but I worry that it will make "find files with a line that doesn't match" impossible to do.

@andyleejordan
Copy link
Contributor

Ha, I almost added this earlier @mernen but ran into exactly the problem you described 😄

@BurntSushi
Copy link
Owner

OK, so I did some more thinking about this and I think the current behavior of -lv is probably the right one. I totally get that it can be confusing, but -v pretty solidly refers to matching at the line level and isn't a generic "do the opposite" flag. In particular, grep -lv behaves the same as rg -lv.

Here is a proposed specification.

Add a new flag --files-without-matches. Only show the path of each file that contains zero matches.

@BurntSushi BurntSushi added help wanted Others are encouraged to work on this issue. and removed help wanted Others are encouraged to work on this issue. labels Nov 19, 2016
mernen added a commit to mernen/ripgrep that referenced this issue Nov 19, 2016
Performs the opposite of --files-with-matches: only shows paths of
files that contain zero matches.

Closes BurntSushi#138
@hauntsaninja
Copy link

(If, like me, you're coming here from Google, the flag that made it into ripgrep is --files-without-match)

@sankalp-khare
Copy link

I keep coming back here to re-check what the flag is 😢

@jeremyfiel
Copy link

how can we use this flag in vs code search?

@BurntSushi
Copy link
Owner

This is the issue tracker for ripgrep. Your question is about VS Code UX. You are in the wrong place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement to the functionality of the software.
Projects
None yet
Development

No branches or pull requests

6 participants