Repository navigation
fmt: preserve leading equals in short prefix options - #15474
Merged
Merged
Conversation
limadog9
force-pushed
the
fix/fmt-equals-prefix-6353
branch
from
October 18, 2026 14:59
cc59c13 to
84057f1
Compare
sylvestre
reviewed
Oct 18, 2026
| if arg == "--" { | ||
| break; | ||
| } | ||
| let Some(value) = arg.to_str() else { |
Contributor
There was a problem hiding this comment.
non-UTF-8 args are skipped here, so -p= followed by invalid bytes still loses the =.
could you work on as_encoded_bytes() instead? and please add a test for it
sylvestre
reviewed
Oct 18, 2026
| } | ||
| break; | ||
| } | ||
| 'c' | 't' | 'm' | 's' | 'u' | 'x' | 'X' | 'q' => {} |
Contributor
There was a problem hiding this comment.
this duplicates the flag list from uu_app(), it will get out of sync when a flag is added.
could we build it from uu_app().get_arguments() (the SetTrue ones) instead?
limadog9
force-pushed
the
fix/fmt-equals-prefix-6353
branch
from
October 18, 2026 22:00
84057f1 to
7edd7ad
Compare
sylvestre
reviewed
Oct 19, 2026
| } | ||
| } | ||
|
|
||
| #[cfg(all(test, unix))] |
Contributor
There was a problem hiding this comment.
could this go in the existing mod tests with a #[cfg(unix)] on the test instead of a new module?
Clap strips a leading equals sign from attached short-option values, but fmt treats it as part of the prefix. Preserve it for -p and -P, including grouped flags, while leaving long options, other values, and operands after -- unchanged. Enable the existing regressions and cover overrides, repeated equals, and prefixes that contain option spellings. Closes uutils#6353.
limadog9
force-pushed
the
fix/fmt-equals-prefix-6353
branch
from
October 19, 2026 19:28
7edd7ad to
4268474
Compare
Contributor
|
Thanks for your PR |
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.
Clap strips a leading equals sign from attached short-option values, but fmt treats it as part of the prefix. Preserve it for -p and -P, including grouped flags, while leaving long options, other values, and operands after -- unchanged.
Enable the existing regressions and cover overrides, repeated equals, and prefixes that contain option spellings.
Closes #6353.