format-table: introduce TABLE_HEADER cell type
authorLennart Poettering <lennart@poettering.net>
Fri, 11 Nov 2022 13:25:51 +0000 (14:25 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 13 Nov 2022 08:36:22 +0000 (17:36 +0900)
commit8f6469cbf9c217a0d9c0e17b63cc49ede00ddf05
tree35918706364117c2559585427ea239ac913661c1
parent1c03f7f4ba419aa65997e90accc0d935ae1cfbc5
format-table: introduce TABLE_HEADER cell type

This rework the logic for handling the "header" cells a bit. Instead of
special casing the first row in regards to uppercasing/coloring let's
just intrduce a proper cell type TABLE_HEADER which is in most ways
identical to TABLE_STRING except that it defaults to uppercase output
and underlined coloring.

This is mostly refactoring, but I think it makes a ton of sense as it
makes the first row less special and you could in fact insert
TABLE_HEADER (and in fact TABLE_FIELD) cells wherever you like and
something sensible would happen (i.e. a string cell is displayed with
a specific formatting).
src/shared/format-table.c
src/shared/format-table.h