Open
Conversation
added 4 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.
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.
Add the sdiff utility in a basic version, see issue #16.
The PR replaces the PRs #159 and #188 as their content is merged in here.
Also a new parser is introduced, as I found too many issues when working with cmp.
feat: Introducing a new parser for all utils
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 revised 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:
with optional byte units, e.g. =1024 or =1024KiB
-- missing and extra operands
-- invalid, ambiguous or conflicting options
-- missing or not allowed option arguments