It would be nice to have an option to supress log messages and errors like in ag. This is useful for using ripgrep in scripts. This comes up when using ripgrep in directories where certain files are not readable.
In ag, there is:
Suppress all log messages, including errors.
Since there is already a --quiet option, this might not be the best name for it, maybe --no-log?
Which log messages do you want to see suppressed?
Anything that isn't results. For example, when folders aren't readable, you currently get:
IO error for operation on ./lost+found: Permission denied (os error 13)
But that's emitted to stderr. You could hide those messages by redirecting stderr to /dev/null. e.g., rg foo 2> /dev/null.
Hm indeed! I guess if all non-result text is emitted on stderr, that should be a fine solution. Ripgrep isn't always used within a shell context though, but I guess there is always the possibility to control stderr.
I think GNU find has the same behavior. I don't see an option to suppress these types of messages, but if it did, I'd consider that a stronger precedent than ag personally.
grep has the following:
-s, --no-messages
Suppress error messages about nonexistent or unreadable files.
However, I do agree that it seems redundant if messages are properly sent to stderr.
I'm guessing this exists because sending stderr to /dev/null is not always appropriate or possible, but can't think of any specific examples. My use-case is solved with redirection.
@cloudhead I consider grep a very strong precedent for a feature like this, although the short -s option is already taken. I'd be fine adding a --no-messages option.
Great. I don't think a short option is necessary.
Most helpful comment
@cloudhead I consider
grepa very strong precedent for a feature like this, although the short-soption is already taken. I'd be fine adding a--no-messagesoption.