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

Skip to first unread message

Simon Michael

Sep 18, 2021, 7:12:58 PM9/18/21
to hledger
Related to


- 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 ?


Sep 19, 2021, 8:05:17 AM9/19/21
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.



Sep 20, 2021, 8:25:17 PM9/20/21
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.


Reply all
Reply to author
0 new messages