olekukonko / tablewriter

ASCII table in golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SetTablePadding() appends excess pad char to data rows

TLINDEN opened this issue · comments

When using said option like this:

table.SetTablePadding("\t")

Then the columns are separated by TAB as whished, but the rows contain an additional TAB at the end.

# output piped to cat -t
NAME  ^IVALUE 
foo   ^Ibar  ^I
blubbi^Ibulga^I

That way it is not further processible using tools like miller:

.. | mlr -i pprint cat
mlr: mlr: CSV header/data length mismatch 2 != 3 at filename (stdin) line  2.

Here miller assumes, that the table has 2 columns as indicated by the two headers separated by 1 TAB. However, as the data columns contain two TABs, miller sees 3 data columns.

So it would be more consistent if the pad char will be appended on the headers as well or not appended anywhere.