Merged
Conversation
sylvestre
reviewed
Mar 21, 2025
sylvestre
reviewed
Mar 21, 2025
sylvestre
reviewed
Mar 21, 2025
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes several issues with the ptx utility related to sorting, regex escaping, and option handling. It updates the ignore_case conversion to correctly fold lowercase letters to uppercase for sorting, improves the REGEX escaping logic for break files, and refines input/output operand handling when GNU extensions are disabled.
- Change ignore_case conversion from lowercase to uppercase.
- Replace custom REGEX character handling with regex::escape.
- Revise option parsing for --format and file operands based on GNU extension settings.
Reviewed Changes
Copilot reviewed 2 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/uu/ptx/src/ptx.rs | Updated flag handling for output format; streamlined regex escaping; fixed case conversion for sorting; improved operand validation |
| tests/by-util/test_ptx.rs | Added tests for rejecting extra operands, regex escaping, and format options |
Files not reviewed (2)
- tests/fixtures/ptx/break_file_escape: Language not supported
- tests/fixtures/ptx/break_file_regex_escaping.expected: Language not supported
Comments suppressed due to low confidence (2)
src/uu/ptx/src/ptx.rs:344
- Changing the conversion to uppercase for ignore_case now correctly implements folding lower case letters for sorting. Please ensure that all sorting-related functionality and tests are updated to reflect this behavior.
word = word.to_uppercase();
src/uu/ptx/src/ptx.rs:253
- The reworked handling of the '--format' option now uses get_one for parsing and then checks for -O/-T flags. Please verify that the precedence of these options is as intended and consider adding an inline comment to clarify the evaluation order.
if let Some(format) = matches.get_one::<String>(options::FORMAT) {
sylvestre
reviewed
Mar 22, 2025
|
GNU testsuite comparison: |
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.
()[]^--formatoption-b,--ignore-fileand--only-fileto accept-as input file