Skip to content

fix: match GNU error format for unrecognized options#180

Open
Ryujiyasu wants to merge 2 commits intouutils:mainfrom
Ryujiyasu:fix/unrecognized-option-format
Open

fix: match GNU error format for unrecognized options#180
Ryujiyasu wants to merge 2 commits intouutils:mainfrom
Ryujiyasu:fix/unrecognized-option-format

Conversation

@Ryujiyasu
Copy link
Contributor

Summary

Follow-up to #178 / #179. Adjusts the unrecognized option error message to match the actual GNU diff/cmp output format:

  • Remove colon after unrecognized option
  • Use single quotes instead of double quotes ('--foobar' instead of "--foobar")
  • Use contains instead of starts_with in integration test to handle the command prefix (e.g. cmp: unrecognized option ...)

Before: unrecognized option: "--foobar"
After: unrecognized option '--foobar'

As pointed out by @GunterSchmidt in #178 (comment).

Test plan

  • cargo test — all 125 unit tests and 21 integration tests pass
  • Verified diffutils diff --foobar outputs unrecognized option '--foobar'
  • Verified diffutils cmp --foobar outputs unrecognized option '--foobar'

Copy link
Contributor

@GunterSchmidt GunterSchmidt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks.

Ryujiyasu and others added 2 commits March 7, 2026 18:35
Use single quotes and remove colon to match GNU diff/cmp output:
`unrecognized option '--foobar'` instead of `unrecognized option: "--foobar"`

Also use `contains` instead of `starts_with` in the integration test
to handle the command prefix (e.g. `cmp: unrecognized option ...`).

Follow-up to uutils#178 / uutils#179.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sylvestre sylvestre force-pushed the fix/unrecognized-option-format branch from e6a28ea to 5398c6d Compare March 7, 2026 17:35
@codspeed-hq
Copy link
Contributor

codspeed-hq bot commented Mar 7, 2026

Merging this PR will not alter performance

✅ 26 untouched benchmarks


Comparing Ryujiyasu:fix/unrecognized-option-format (5398c6d) with main (59e130a)

Open in CodSpeed

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.

2 participants