Repository navigation
diff: accept clustered short options such as -qst and -ut - #304
Open
SichenLiang wants to merge 1 commit into
Open
SichenLiang wants to merge 1 commit into
SichenLiang wants to merge 1 commit into
Conversation
Handle the seven short options that take no argument through the same path in their separate and clustered forms. Keeping the existing fallback when a word contains an unsupported option, and share the output-style conflict checks between both forms. Add parser and command-output tests for clustered options.
Contributor
Merging this PR will improve performance by 3.15%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ |
cmd_cmp_gnu_equal[25000] |
23 µs | 22.3 µs | +3.22% |
| ⚡ |
cmd_cmp_gnu_equal[10000] |
23 µs | 22.3 µs | +3.21% |
| ⚡ |
cmd_diff_gnu_equal[10000] |
23.1 µs | 22.3 µs | +3.21% |
| ⚡ |
cmd_diff_gnu_equal[1000] |
23.1 µs | 22.3 µs | +3.21% |
| ⚡ |
cmd_diff_gnu_equal[25000] |
23.1 µs | 22.4 µs | +3.2% |
| ⚡ |
cmd_cmp_gnu_equal[100] |
23.6 µs | 22.9 µs | +3.13% |
| ⚡ |
cmd_diff_gnu_equal[100] |
24.4 µs | 23.7 µs | +3.03% |
| ⚡ |
cmd_diff_release_equal[1000] |
24.4 µs | 23.6 µs | +3.03% |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing SichenLiang:short-option-clusters (385935e) with main (2d605f6)
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.
GNU diff allows short options that take no argument to be combined, so
diff -qst a bis the same asdiff -q -s -t a b. uutils treated the combined form as one unknown option.The existing argument-free options (
-c,-e,-q,-s,-t,-uand-y) now use the same path whether they are separate or clustered. Output-style conflicts are checked in the same place, while a word containing an unsupported option keeps the old handling.Fixes #298