Commit graph

14 commits

Author SHA1 Message Date
Lennart Poettering 359abf6dd0 format-table: add option to uppercase cells on display
This adds a per-cell option for uppercasing displayed strings.
Implicitly turn this on for the header row. The fact that we format the
table header in uppercase is a formatting thing after all, hence should
be applied by the formatter, i.e. the table display code.

Moreover, this provides us with the benefit that we can more nicely
reuse the specified table headers as JSON field names, like we already
do: json field names are usually not uppercase.
2018-12-03 22:42:38 +01:00
Lennart Poettering 31ac235771 format-table: optionally covert/output table to JSON 2018-12-03 22:42:38 +01:00
Lennart Poettering c93d372d7c format-table: use right field for display
Since .timespan and .timestamp are unionized on top of each other this
doesn't actually matter, but it is still more correct to address it
under it's correct name.
2018-12-03 22:42:38 +01:00
Lennart Poettering 88db94fa57 format-table: make sure we never call memcmp() with NULL parameters 2018-11-30 16:46:10 +01:00
Lennart Poettering 62d99b3970 format-table: add calls to query the data in a specific cell 2018-11-30 16:46:10 +01:00
Lennart Poettering 30d98de00c format-table: always underline header line 2018-11-30 16:46:10 +01:00
Lennart Poettering 9314ead785 format-table: add an API for getting the cell at a specific row/column 2018-11-30 16:46:10 +01:00
Lennart Poettering 27e730e6d0 format-table: add table_update() to update existing entries 2018-11-30 16:46:10 +01:00
Lennart Poettering a2c73e2d38 format-table: optionally allow reversing the sort order for a column 2018-11-30 16:46:10 +01:00
Lennart Poettering a4661181fa format-table: add option to store/format percent and uint64_t values in cells 2018-11-30 16:46:10 +01:00
Lennart Poettering a22318e554 format-table: before outputting a color, check if colors are available
This is in many cases redundant, as a similar check is done by various
callers already, but in other cases (where we read the color from a
static table for example), it's nice to let the color check be done by
the table code itself, and since it doesn't hurt in the other cases just
do it again.
2018-11-30 16:46:10 +01:00
Lennart Poettering 165ca5663e format-table: optionally make specific cells clickable links 2018-11-30 16:46:10 +01:00
Lennart Poettering 13b0d4d7bd format-table: when duplicating a cell, also copy the color 2018-11-30 16:46:10 +01:00
Zbigniew Jędrzejewski-Szmek d284b82b3e Move various files that don't need to be in basic/ to shared/
This doesn't have much effect on the final build, because we link libbasic.a
into libsystemd-shared.so, so in the end, all the object built from basic/
end up in libsystemd-shared. And when the static library is linked into binaries,
any objects that are included in it but are not used are trimmed. Hence, the
size of output artifacts doesn't change:

$ du -sb /var/tmp/inst*
54181861	/var/tmp/inst1    (old)
54207441	/var/tmp/inst1s   (old split-usr)
54182477	/var/tmp/inst2    (new)
54208041	/var/tmp/inst2s   (new split-usr)

(The negligible change in size is because libsystemd-shared.so is bigger
by a few hundred bytes. I guess it's because symbols are named differently
or something like that.)

The effect is on the build process, in particular partial builds. This change
effectively moves the requirements on some build steps toward the leaves of the
dependency tree. Two effects:
- when building items that do not depend on libsystemd-shared, we
  build less stuff for libbasic.a (which wouldn't be used anyway,
  so it's a net win).
- when building items that do depend on libshared, we reduce libbasic.a as a
  synchronization point, possibly allowing better parallelism.

Method:
1. copy list of .h files from src/basic/meson.build to /tmp/basic
2. $ for i in $(grep '.h$' /tmp/basic); do echo $i; git --no-pager grep "include \"$i\"" src/basic/ 'src/lib*' 'src/nss-*' 'src/journal/sd-journal.c' |grep -v "${i%.h}.c";echo ;done | less
2018-11-20 07:27:37 +01:00
Renamed from src/basic/format-table.c (Browse further)