-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
ptx: fixes #7521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ptx: fixes #7521
Conversation
GNU testsuite comparison:
|
GNU testsuite comparison:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) {
GNU testsuite comparison:
|
()[]^
--format
option-b
,--ignore-file
and--only-file
to accept-
as input file