Add --no-matches-message flag for empty search results#2015
Conversation
Print an optional status message to stderr when a search yields no results. Respects quiet mode and does not affect the default silent behavior. Fixes sharkdp#1819
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c2a98993c6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| if self.num_results == 0 | ||
| && self.config.no_matches_message | ||
| && self.config.is_printing() |
There was a problem hiding this comment.
Remove printing-mode gate for no-match status
--no-matches-message is described as a search-level status flag, but this condition requires self.config.is_printing(), which is false whenever --exec/--exec-batch is used. That makes the new flag silently ineffective in command-execution workflows (e.g., fd --no-matches-message -x ... PATTERN with zero matches), even though those workflows still perform a search and can end with no results. This should either be emitted regardless of print mode (except quiet) or explicitly documented as unsupported for exec modes.
Useful? React with 👍 / 👎.
c2a9899 to
2778315
Compare
Summary
--no-matches-messageflag that prints a status message to stderr when a search yields no results[fd]: No matches found for pattern: '{pattern}'(or[fd]: No matches foundwhen no pattern is given)-q/--quiet(no message printed)Fixes #1819
Test plan
cargo test test_no_matches_message— verifies message is printed with the flagcargo test test_no_matches_message_respects_quiet— verifies quiet mode suppresses the messagecargo test— full test suite passes (139 unit + 109 integration tests)