12 Commits

Author SHA1 Message Date
Matthias Clasen
d1b4719ab8 table printer: Redo column handling
Move expand and ellipsize to the Column struct,
and change flatpak_table_printer_set_column_titles
to flatpak_table_printer_set_columns that sets up
not just the title, but also expand and ellipsize.

Update all callers.

Closes: #2460
Approved by: alexlarsson
2019-01-14 13:35:56 +00:00
Alexander Larsson
b7e06dee2d tables: Add support for ellipsize start and use for app id
I think this makes a lot more sense than ellipsizing in the middle.
Most app ids start with a common prefix after all.

Closes: #2448
Approved by: alexlarsson
2018-12-20 16:08:44 +00:00
Matthias Clasen
f3c6e647c1 table printer: Support middle ellipsization
This is sometimes better than ellipsizing at the end.

Closes: #2448
Approved by: alexlarsson
2018-12-20 16:08:44 +00:00
Alexander Larsson
89650f503c table-printer: Add support for sorting rows
Closes: #2450
Approved by: alexlarsson
2018-12-20 15:50:07 +00:00
Matthias Clasen
f0d4665901 Add ellipsizing to the table printer
Optionally mark a column as ellipsizing.

Currently, this won't work correctly if more
than one column is ellipsizing.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
908703d64a table printer: Add per-column expand api
When we are given a with that is larger than the content we have,
expand the space between columns, within reason. We only make the
table at most 1.5 times as wide as it would be unexpanded.

Add a new API for setting individual columns to expand (or not).
For an expanding column, we'll grow the space between it and its
preceding column. The expand flag of the first column is ignored.

By default, columns do not expand.

Make flatpak_table_printer_print_full return not just the table
height, but also the width.

Update all callers.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
3fe15ef665 table printer: Add a decimal cell setter
The download column really hsold be decimal, and we want
to update it while the download is running.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
8fa0f73067 table printer: Add cell and row apis
Add a way to change individual cells and  a getter for the
current row. Also add a variation of the print() method that
returns the number of terminal rows that was generated
when formatting to given width, while skipping a number
of rows at the beginning. This method will be used in the
following commit to print a part of the table into a terminal
window of a given size.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
259e438d4b Add table printer convenience api for columns
This code is repeated in ever single command using
columns, so lets pull it into a utility function.

Closes: #2090
Approved by: alexlarsson
2018-10-05 15:19:43 +00:00
Alexander Larsson
3f4518b15c Run uncrustify
Closes: #1870
Approved by: alexlarsson
2018-07-08 10:05:37 +00:00
Alexander Larsson
b1a7930cc7 TablePrinter: Add span cells
These can be used to print rows that are not cell-aligned.

Closes: #1799
Approved by: alexlarsson
2018-06-19 14:54:22 +00:00
Alexander Larsson
7c17e77e84 Move FlatpakTablePrinter to app/
This is only used by the CLI

Closes: #1706
Approved by: alexlarsson
2018-05-24 11:59:52 +00:00