RFC: what number styling should be done in CSV output ?

12 views
Skip to first unread message

Simon Michael

unread,
Sep 18, 2021, 7:12:58 PMSep 18
to hledger
Related to

Currently, 

- numbers in hledger print's CSV output are unstyled, except for the decimal mark. This was done to make print's output machine readable (https://github.com/simonmichael/hledger/pull/1258).

- numbers in other commands' CSV output are fully styled, including eg thousands separators. This might be preferable for report output, which is most often intended for human viewing. (Scripters might sometimes want to parse report output, however.)

Similarly, -c|--commodity-style affects only the decimal mark in print's CSV output, but affects all of the number style in other commands' CSV output.

This is inconsistent, but nobody has complained. Do you think we should change it to a more consistent rule, affecting all commands equally: "Numbers in CSV output are always unstyled except for the decimal mark, by default. You can override their style with -c|--commodity-style." ? What hassles might this change in CSV output cause you ?


niels...@gmail.com

unread,
Sep 19, 2021, 8:05:17 AMSep 19
to hledger
Yes, I would say yes to having csv output unstyled (except for decimal mark) for all csv output as the default. 

For example, if you are trying to do some custom processing of csv output with something like awk, it would be nice to have just one default format to work with. 

I realize, though, that others may have a need for the current behavior. It would be interesting to hear those examples.

Rob

the.so...@gmail.com

unread,
Sep 20, 2021, 8:25:17 PMSep 20
to hledger
Dear Simon,
I would think that it would make most sense to have all CSV output unstyled by default. Visual styling (thousands separators, etc., for human consumption) can be, and ought to be, applied in spreadsheet programmes (without changing the data), and ought not be applied at the data level by hledger.

But I'm not very particular about it either way.

Regards,
Pranesh

Reply all
Reply to author
Forward
0 new messages