summaryrefslogtreecommitdiff
path: root/src/analyze
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2022-11-11 09:11:30 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-11-13 20:21:03 +0900
commitf607ebcac26bfd9f55622b1719c2121849a4c67a (patch)
treebb29af3ecedeb5d1f694bc1cb1d35879eee1766c /src/analyze
parent9c7a5ff6ccfd65cdbfa40d1565c4cf862a49e12f (diff)
downloadsystemd-f607ebcac26bfd9f55622b1719c2121849a4c67a.tar.gz
analyze-calendar: port to vertical table
Diffstat (limited to 'src/analyze')
-rw-r--r--src/analyze/analyze-calendar.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/analyze/analyze-calendar.c b/src/analyze/analyze-calendar.c
index a53d11580b..6daab08443 100644
--- a/src/analyze/analyze-calendar.c
+++ b/src/analyze/analyze-calendar.c
@@ -24,21 +24,15 @@ static int test_calendar_one(usec_t n, const char *p) {
if (r < 0)
return log_error_errno(r, "Failed to format calendar specification '%s': %m", p);
- table = table_new("name", "value");
+ table = table_new_vertical();
if (!table)
return log_oom();
- table_set_header(table, false);
-
assert_se(cell = table_get_cell(table, 0, 0));
r = table_set_ellipsize_percent(table, cell, 100);
if (r < 0)
return r;
- r = table_set_align_percent(table, cell, 100);
- if (r < 0)
- return r;
-
assert_se(cell = table_get_cell(table, 0, 1));
r = table_set_ellipsize_percent(table, cell, 100);
if (r < 0)
@@ -46,14 +40,14 @@ static int test_calendar_one(usec_t n, const char *p) {
if (!streq(t, p)) {
r = table_add_many(table,
- TABLE_STRING, "Original form:",
+ TABLE_FIELD, "Original form",
TABLE_STRING, p);
if (r < 0)
return table_log_add_error(r);
}
r = table_add_many(table,
- TABLE_STRING, "Normalized form:",
+ TABLE_FIELD, "Normalized form",
TABLE_STRING, t);
if (r < 0)
return table_log_add_error(r);
@@ -65,7 +59,7 @@ static int test_calendar_one(usec_t n, const char *p) {
if (r == -ENOENT) {
if (i == 0) {
r = table_add_many(table,
- TABLE_STRING, "Next elapse:",
+ TABLE_FIELD, "Next elapse",
TABLE_STRING, "never",
TABLE_SET_COLOR, ansi_highlight_yellow());
if (r < 0)
@@ -78,7 +72,7 @@ static int test_calendar_one(usec_t n, const char *p) {
if (i == 0) {
r = table_add_many(table,
- TABLE_STRING, "Next elapse:",
+ TABLE_FIELD, "Next elapse",
TABLE_TIMESTAMP, next,
TABLE_SET_COLOR, ansi_highlight_blue());
if (r < 0)
@@ -91,7 +85,7 @@ static int test_calendar_one(usec_t n, const char *p) {
else
k = 0;
- r = table_add_cell_stringf(table, NULL, "Iteration #%u:", i+1);
+ r = table_add_cell_stringf_full(table, NULL, TABLE_FIELD, "Iteration #%u", i+1);
if (r < 0)
return table_log_add_error(r);
@@ -104,14 +98,14 @@ static int test_calendar_one(usec_t n, const char *p) {
if (!in_utc_timezone()) {
r = table_add_many(table,
- TABLE_STRING, "(in UTC):",
+ TABLE_FIELD, "(in UTC)",
TABLE_TIMESTAMP_UTC, next);
if (r < 0)
return table_log_add_error(r);
}
r = table_add_many(table,
- TABLE_STRING, "From now:",
+ TABLE_FIELD, "From now",
TABLE_TIMESTAMP_RELATIVE, next);
if (r < 0)
return table_log_add_error(r);