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

--files --quiet should be quiet #483

Closed
alecthomas opened this issue May 17, 2017 · 7 comments
Closed

--files --quiet should be quiet #483

alecthomas opened this issue May 17, 2017 · 7 comments
Labels
bug A bug.

Comments

@alecthomas
Copy link

rg --files always lists files, even if --quiet is passed. I did not expect that.

@nateozem
Copy link

From --help

   -q, --quiet
           Do not print anything to stdout. If a match is found in a file, stop searching. This is
           useful when ripgrep is used only for its exit code.

"anything" didn't apply, unless --quiet needs a redefinition.

@BurntSushi
Copy link
Owner

I suppose in order to make this useful, ripgrep should return an error exit code if --files would otherwise result in no output. (Otherwise, I don't know what the point of --quiet is.)

@BurntSushi BurntSushi added the question An issue that is lacking clarity on one or more points. label May 17, 2017
@BurntSushi
Copy link
Owner

@alecthomas Can you say more about why you're trying to use --files --quiet?

@alecthomas
Copy link
Author

alecthomas commented May 17, 2017

Similar to why I'd use a normal ripgrep(!)... I want to know if files with a certain extension exist, for the purposes of further processing. A bit like find . -type f -name '*.h' > /dev/null && do_something

@alecthomas
Copy link
Author

I'm doing if rg --files --quiet --glob '*.go'; then ... fi

@BurntSushi
Copy link
Owner

Ah, OK, I actually didn't even know ripgrep already handled the exit code correctly here. Nice. Yes, --quiet should work.

@BurntSushi BurntSushi added bug A bug. and removed question An issue that is lacking clarity on one or more points. labels May 17, 2017
@alecthomas
Copy link
Author

👍

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

No branches or pull requests

3 participants