coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

numfmt: implement missing options

Open arsdragonfly opened this issue 7 years ago • 10 comments

Currently these options available in GNU numfmt are still missing:

  • [ ] --debug
  • [x] -d/--delimiter
  • [x] --field
  • [ ] --from-unit
  • [ ] --grouping
  • [ ] --invalid
  • [x] --round
  • [x] --suffix
  • [ ] -z/--zero-terminated

I'll be implementing them as much as I can.

arsdragonfly avatar Aug 26 '18 12:08 arsdragonfly

Is it okay for me to have a go at few of these? (currently thinking of --field/-d)

Fine if you want to do it of course :)

JJJollyjim avatar Sep 24 '18 12:09 JJJollyjim

Yes you can work on that.

Jamie [email protected] 于 2018年9月24日周一 08:27写道:

Is it okay for me to have a go at few of these? (currently thinking of --field/-d)

Fine if you want to do it of course :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/uutils/coreutils/issues/1280#issuecomment-423957426, or mute the thread https://github.com/notifications/unsubscribe-auth/AD4QkXKXMJFT1WhIyO9sGSQIeoBCJK4Oks5ueM_IgaJpZM4WMwnF .

arsdragonfly avatar Sep 24 '18 13:09 arsdragonfly

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 27 '21 10:03 stale[bot]

Looks like -d, --field, and --round have been implemented:

$ ./target/debug/coreutils numfmt --help
[...]
OPTIONS:
    -d, --delimiter <X>     use X instead of whitespace for field delimiter
        --field <FIELDS>    replace the numbers in these input fields (default=1) see FIELDS below [default: 1]
        --from <UNIT>       auto-scale input numbers to UNITs; see UNIT below [default: none]
        --header <N>        print (without converting) the first N header lines; N defaults to 1 if not specified
        --padding <N>       pad the output to N characters; positive N will right-align; negative N will left-align; padding is ignored if the output is wider than N; the default is to automatically pad
                            if a whitespace is found
        --round <METHOD>    use METHOD for rounding when scaling; METHOD can be: up,down, from-zero (default), towards-zero, nearest [default: from-zero]  [possible values: up, down, from-zero, towards-
                            zero, nearest]
        --to <UNIT>         auto-scale output numbers to UNITs; see UNIT below [default: none]

jfinkels avatar Aug 29 '21 19:08 jfinkels

I've implemented suffix now, which solved 18 of the GNU numfmt tests. Might have a look at --invalid next :)

sbentmar avatar Jan 03 '22 01:01 sbentmar

@sbentmar , thanks for the contribution!

I can't find the test changes; the total GNU test summary reports "GNU tests summary = TOTAL: 601 / PASS: 199 / FAIL: 295 / ERROR: 23", unchanged from 'master'. Am I missing the test change somewhere else?

rivy avatar Jan 03 '22 04:01 rivy

@rivy probably because the .sh test from gnu isn't fulling passing.

sylvestre avatar Jan 03 '22 08:01 sylvestre

Sorry for the confusion, 18 more of the ~400 numfmt Perl test cases are passing now. I suspect that the entire numfmt.pl test suite counts as a single test in the complete summary, so all the 400 tests need to pass for it to count. There are still 171 failing test cases, in that case :)

sbentmar avatar Jan 03 '22 10:01 sbentmar

Sorry for the confusion, 18 more of the ~400 numfmt Perl test cases are passing now. I suspect that the entire numfmt.pl test suite counts as a single test in the complete summary, so all the 400 tests need to pass for it to count. There are still 171 failing test cases, in that case :)

Ah, thanks for the clarification.

rivy avatar Jan 04 '22 01:01 rivy

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 20 '23 04:01 stale[bot]