fcli icon indicating copy to clipboard operation
fcli copied to clipboard

Output: Investigate incremental output

Open rsenden opened this issue 3 years ago • 1 comments

All current list commands first load all data, and then generate the output. For example, SSC list commands use limit=-1 to have SSC return all records in a single request. For large lists, it can take relatively long before any output is displayed.

We could potentially display progress information (as already done for some upload and download commands), but this may affect some automations (like piping the output from one command to another).

Alternatively, we can investigate incremental output, where data is loaded in multiple pages, and each page is directly added to the output. Unirest has native support for paged requests, and OutputMixin already passes individual records to the various output formatters.

However, some output formatters collect all records before displaying any output. For example, the table output formatter collects all records in order to determine appropriate column widths. Maybe we can change such formatters to calculate the column width based on the first x columns, and then use the same column width for the remaining records. Obviously this may cause formatting issues though, especially if there are large variations in column widths between the records. For example, for the first x records a column width of 5 may be calculated, but for the next y records a column width of 10 could be more appropriate.

rsenden avatar Sep 14 '22 23:09 rsenden

In regards to displaying progress information, we can write to stdout, but not flush. When it comes time to actually output real data, we'd just need to clear or overwrite the lines that the status information was on. This should have the effect of not having that status information being redirected or piped. That's what I see people saying, as I've been researching how to work around this same issue.

MikeTheSnowman avatar Sep 16 '22 00:09 MikeTheSnowman

Most output formats, apart from table, now support streaming output, so closing this issue

rsenden avatar Mar 18 '25 12:03 rsenden