Error: Invalid count value when no rows
The following code fails with the Invalid count value when no rows error.
import { printTable, Table } from 'console-table-printer';
const table = new Table({
title: 'Project folders',
});
table.printTable();
It looks like the textWithPadding() function in the string-utils file does not handle situation when the size is invalid.
The use case is to print the table header even when there are no items to render.
@jarrodek what is your expected output for this? Why do you want to print only table header?
Essentially yes. The command in my CLI I am building may not return any results (for example when a query yields no results). The command's output is still the same which is the table but in this specific case, it has no rows. This way the interface stays consistent regardless of the result.
This also fails when the title length > column length.
This works because the title is short
const t = new Table({ title: 'Short'}, columns: ['test'], ['example']);
t.addRow({ test: 1, example: 2 });
t.printTable();
This fails due to the title being longer than the columns
new Table({ title: 'Really long title that is longer than the table itself'}, columns: ['test'], ['example']);
t.addRow({ test: 1, example: 2 });
t.printTable();
:tada: This issue has been resolved in version 2.11.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Seems already been resolved