From: Zbigniew Jędrzejewski-Szmek Date: Fri, 22 Feb 2019 08:29:23 +0000 (+0100) Subject: analyze: add color highlighting when printing calendar elapses X-Git-Tag: v242-rc1~256^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11797%2Fhead;p=thirdparty%2Fsystemd.git 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. --- 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())