Closed waldekmastykarz closed 6 years ago
The problem is with multiline content. It's not currently supported (#18).
@eldargab the issue you referenced is caused by content with a line break. In my case, the content is single line, just too long. If you think it's the same, I'd suggest you keep this issue in mind as an extra test case.
Ah, I see...
I think this problem is out of scope. In general .printTransposed()
is about turning rows to columns and vice versa. If your task is just to print key-value correspondence it's much simpler to devise a special function for that, since such function doesn't need any logic specific to easy-table
.
Gotcha, in that case I misunderstood the purpose of printTransposed()
. I'm using a custom function at the moment, but it's good to have it confirmed that easy-table was not meant to be used for key-value pairs.
When printing table transposed, easy-table determines the width of the value cell, based on the longest value. If one of the values is very long, this results in awkward output with a lot of white space surrounding shorter values. Preferably, easy-table should determine only the max-width of the key-cell and print values with variable width.
Repro steps:
Output (the exact number of white space depends on the terminal width. Here new lines added to illustrate the problem):
Preferable output: