numfmt: accept hyphen-leading -d/--suffix/--padding values - #14322
Open
arbelonson-source wants to merge 1 commit into
Open
numfmt: accept hyphen-leading -d/--suffix/--padding values#14322arbelonson-source wants to merge 1 commit into
arbelonson-source wants to merge 1 commit into
Conversation
-d/--delimiter, --suffix, and --padding all had the same gap already fixed this session for several other options: their value was rejected as an unrecognized flag when given as its own argument (numfmt --padding -8, not the attached --padding=-8), since the Args were missing allow_hyphen_values. GNU's own numfmt accepts any argument as these options' values regardless of the first character -- including a negative --padding, which is meaningful (left-justifies instead of right-justifying). --padding already parsed as a signed isize, so no change was needed beyond letting clap route the value to it in the first place. AI-assisted-by: Claude Opus 5, via Claude Code
|
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.
What
-d/--delimiter,--suffix, and--paddingall had the same gapalready fixed this session for several other options: their value was
rejected as an unrecognized flag when given as its own argument, since
the
Args were missingallow_hyphen_values:The attached form (
--padding=-8, etc.) already worked; only theseparate-argument form broke -- the same gap already fixed this
session for
sort --parallel,nl's numeric options,ptx --gap-size/--width,join -t,csplit --suffix-format, andpaste -d.--paddingalready parsed its value as a signedisize, so no changewas needed there beyond letting clap route the value to it in the
first place.
Testing
cargo test -p uu_numfmt/ fulltests/by-util/test_numfmt.rssuite: 188 passed, 0 failed.--suffix -x/x,--padding -5/5/-0, and-d -x/:against GNU numfmt 9.11 underLC_ALL=C.cargo clippy -p uu_numfmt --all-targets -- -D warningsandcargo fmt --check: clean.This PR was written with AI assistance (Claude Opus 5, via Claude Code). I've tested the changes but please review the code carefully.