From deed4d50a2e437493d95be0f2e0b845222fff702 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 22 Feb 2019 09:29:23 +0100 Subject: [PATCH] analyze: add color highlighting when printing calendar elapses With multiple iterations, I found it hard to pick out the interesting bits in the column of text. I tried plain highlighting first, but it doesn't seem enough. But blue/yellow makes it easy to jump to the right iteration. --- src/analyze/analyze.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c index 337089a40da..77adbed83d9 100644 --- a/src/analyze/analyze.c +++ b/src/analyze/analyze.c @@ -1700,14 +1700,16 @@ static int test_calendar_one(usec_t n, const char *p) { r = calendar_spec_next_usec(spec, n, &next); if (r == -ENOENT) { if (i == 0) - printf(" Next elapse: never\n"); + printf(" Next elapse: %snever%s\n", + ansi_highlight_yellow(), ansi_normal()); return 0; } if (r < 0) return log_error_errno(r, "Failed to determine next elapse for '%s': %m", p); if (i == 0) - printf(" Next elapse: %s\n", format_timestamp(buffer, sizeof(buffer), next)); + printf(" Next elapse: %s%s%s\n", + ansi_highlight_blue(), format_timestamp(buffer, sizeof(buffer), next), ansi_normal()); else { int k = DECIMAL_STR_WIDTH(i+1); @@ -1716,7 +1718,9 @@ static int test_calendar_one(usec_t n, const char *p) { else k = 0; - printf("%*sIter. #%u: %s\n", k, "", i+1, format_timestamp(buffer, sizeof(buffer), next)); + printf("%*sIter. #%u: %s%s%s\n", + k, "", i+1, + ansi_highlight_blue(), format_timestamp(buffer, sizeof(buffer), next), ansi_normal()); } if (!in_utc_timezone()) -- 2.47.3