Skip to content

grep: reject conflicting matcher flags#47

Open
wondr-wclabs wants to merge 1 commit into
uutils:mainfrom
wondr-wclabs:codex/reject-conflicting-matchers
Open

grep: reject conflicting matcher flags#47
wondr-wclabs wants to merge 1 commit into
uutils:mainfrom
wondr-wclabs:codex/reject-conflicting-matchers

Conversation

@wondr-wclabs
Copy link
Copy Markdown
Contributor

Closes #3.

GNU grep treats matcher selection as a choice between modes: -F, -E, -G, and -P can each be repeated idempotently, but mixing different modes is a usage error. The old parser model used Clap overrides, which made mixed modes silently become “last flag wins.”

This changes the parser to preserve which matcher flags were present and then performs a small GNU-style validation step in uumain. I used custom validation instead of Clap conflicts so the diagnostic matches the behavior described in the issue (conflicting matchers specified) while still accepting repeated identical flags such as -F -F and -E -E.

The regression test covers the listed mixed-mode combinations, a long-option pair, and repeated same-mode controls.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jun 5, 2026

Merging this PR will not alter performance

✅ 10 untouched benchmarks
⏩ 17 skipped benchmarks1


Comparing wondr-wclabs:codex/reject-conflicting-matchers (2a9296c) with main (d28bf76)

Open in CodSpeed

Footnotes

  1. 17 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@wondr-wclabs wondr-wclabs force-pushed the codex/reject-conflicting-matchers branch from e746cf4 to 97105be Compare June 5, 2026 08:01
@wondr-wclabs wondr-wclabs force-pushed the codex/reject-conflicting-matchers branch from 97105be to 2a9296c Compare June 5, 2026 08:08
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.

accepts conflicting matcher flags instead of erroring like GNU (-F/-E/-G/-P combinations)

1 participant