Skip to content

fix(grep): forward short no-filename flag - #3085

Closed
lntutor wants to merge 1 commit into
rtk-ai:developfrom
lntutor:fix/2391-grep-short-h
Closed

lntutor wants to merge 1 commit into
rtk-ai:developfrom
lntutor:fix/2391-grep-short-h

Conversation

@lntutor

@lntutor lntutor commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • disable Clap's automatic short help flag for the grep subcommand only
  • forward -h to native grep as GNU --no-filename instead of printing RTK help
  • preserve long-form rtk grep --help behavior
  • add parser and end-to-end multi-file regression coverage

Testing

  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test --all-features (2,497 passed, 8 ignored)

Closes #2391

@CLAassistant

CLAassistant commented Jul 20, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@KuSh

KuSh commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator

Thanks for this fix. #4348, merged on 2026-10-14, stopped rtk from claiming -h, --help and help on every subcommand it wraps, so rtk grep -h now reaches grep as --no-filename. Develop also already has an end-to-end test (grep_dash_h_searches_and_drops_the_filename) that compares -h, -rh, a trailing -h and -h -n with native grep, which covers the test added here. If I missed a case this PR handles, please comment and it can be reopened.

@KuSh KuSh closed this Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rtk grep -h prints help instead of searching — clap intercepts GNU grep's -h (--no-filename), exit 0, no native fallback

3 participants