Repository navigation
Conversation
5 tasks done
`rtk grep -h PATTERN FILES` printed rtk's own usage text: clap's auto help flag captured `-h` before search.rs, which already reads it as grep's --no-filename (and as help for rg only), could see it. Agents piping `grep -ho ... | sort | uniq -c` got the help screen and fell back to `rtk proxy grep`. Disable clap's help flag on the Grep subcommand; `--help` still reaches the engine through search.rs. The integration test pins `-h`, `-ho` and `-H` against real grep byte for byte.
dmazhukov
force-pushed
the
fix/grep-h-no-filename
branch
from
September 27, 2026 03:33
2780ce9 to
fecc922
Compare
Collaborator
|
Thanks for this, and for pinning the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #3663 (the
-hpart;-l/-m/-tare already long-only ondevelop).Summary
rtk grep -h PATTERN FILESstill prints rtk's usage text ondevelop: clap's auto help flag captures-hbeforesearch.rs, which already reads it as grep's--no-filename(and as help for rg only), ever sees it. Agents pipinggrep -ho ... | sort | uniq -cget the help screen and fall back tortk proxy grep.This disables clap's help flag on the
Grepsubcommand (same precedent asPsql).--helpstill reaches the engine throughsearch.rs. Rebased on currentdevelop: the filename handling from the first version is dropped, sincedevelopnow does it insearch.rs.Test plan
cargo fmt --all && cargo clippy --all-targets && cargo testdash_h_is_no_filename_not_helpintests/grep_faithful_format_test.rspins-h,-hoand-Hagainst real grep byte for byteSide note, not addressed here: with
-h -Htogetherdevelopfollows GNU grep (last flag wins, filename shown), while BSD grep on macOS lets-hwin regardless of order.