Skip to content

Templated output for CSV #22

Description

@eblechschmidt

Hello Joshua,

thank you for this awesome tool. I would be interested to have a more flexible way of changeing the content of the CSV ouput (for e.g. adding the remittance info). Would you be interested in a PR using go template to format the output?

I could imaging two possbile solutions to this:

  1. CSV foramting completely determinde by template. For transactions the template could look something like:
REMITTER,DEPTOR,BOOKING DATE,STATUS,TYPE,VALUE,UNIT
{{range .Values}}{{.Creditor.HolderName}},{{.BookingDate}},{{t.BookingStatus}},{{t.TransactionType.Text}},{{.Amount | formatAmountValue}},{{t.Amount.Unit}}
{{end}}

In this case I would embed a template file which keeps the current setup and I would add an additional flag for specifying a custom template file path.

  1. Separate the header and the row into two templates:
header_tpl := "REMITTER,DEPTOR,BOOKING DATE,STATUS,TYPE,VALUE,UNIT"
row_tpl := "{{.Creditor.HolderName}},{{.BookingDate}},{{t.BookingStatus}},{{t.TransactionType.Text}},{{.Amount | formatAmountValue}},{{t.Amount.Unit}}"

In this case I would add two flags (one for the header and one for the row template) which would override the default formating.

Which of the solutions would you prefer? I don't really care.

Best regards

Eike

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions