Skip to content

Panic on broken pipe#194

Closed
GunterSchmidt wants to merge 6 commits intouutils:mainfrom
GunterSchmidt:panic-on-broken-pipe
Closed

Panic on broken pipe#194
GunterSchmidt wants to merge 6 commits intouutils:mainfrom
GunterSchmidt:panic-on-broken-pipe

Conversation

@GunterSchmidt
Copy link
Contributor

This fixes issue #192.

Code copied from coreutils.

Please check if this is the desired behavior.

Gunter Schmidt added 5 commits March 9, 2026 10:59
This is a new fully working parser for the arg options.
The parser is written generically so it can be used in all diffutils tools.
The first implementation is done with sdiff. I already have a version for cmp as well.

I checked and discarded clap as tool, as the requirements are very individual and would require extensive tweaking of the clap functionality.

Features:

- Allows options to be abbreviated, e.g. --wi instead of --width
- Allows input like in GNU utils, e.g. the following are all identical
  - diff --ignore-case --minimal --width=50 file_a file_b
  - diff --ignore-case --minimal --width 50 file_a file_b
  - diff -i -d -w 50 file_a file_b
  - diff -id -w50 file_a file_b
  - diff -idw50 file_a file_b
- A number parser is available, which parses option arguments
  with optional byte units, e.g. =1024 or =1024KiB
- Default handling for --version and --help
- Returns the params or an Error Enum, which makes it library friendly.
- Contains error handling for the typical parsing errors:
  -- missing and extra operands
  -- invalid, ambiguous or conflicting options
  -- missing or not allowed option arguments
- Provides error text functions, e.g. add executable and 'Try --help' to message.
@GunterSchmidt GunterSchmidt mentioned this pull request Mar 9, 2026
@oSoMoN
Copy link
Collaborator

oSoMoN commented Mar 9, 2026

Can you rebase the relevant commit (bfd8ebc) on top of main, i.e. without all the changes for your sdiff parser?

@GunterSchmidt
Copy link
Contributor Author

Yes, that was indeed accidentally. Will fix it. Closing this PR.

@GunterSchmidt GunterSchmidt deleted the panic-on-broken-pipe branch March 11, 2026 00:44
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