From 5b262f74e470419ebaf8ec8053558825057bdd21 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 23 Nov 2018 17:46:25 +0100 Subject: [PATCH] unit: tweak status output a bit Let's highlight the unit description string in the status updates, to separate them a bit more the english sentence they are part of, and thus make the different casing less surprising. --- src/core/unit.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core/unit.c b/src/core/unit.c index df340548bb7..73a625e7a17 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -46,6 +46,7 @@ #include "string-table.h" #include "string-util.h" #include "strv.h" +#include "terminal-util.h" #include "umask-util.h" #include "unit-name.h" #include "unit.h" @@ -1644,12 +1645,17 @@ static bool unit_assert_test(Unit *u) { } void unit_status_printf(Unit *u, const char *status, const char *unit_status_msg_format) { + const char *d; + + d = unit_description(u); + if (log_get_show_color()) + d = strjoina(ANSI_HIGHLIGHT, d, ANSI_NORMAL); + DISABLE_WARNING_FORMAT_NONLITERAL; - manager_status_printf(u->manager, STATUS_TYPE_NORMAL, status, unit_status_msg_format, unit_description(u)); + manager_status_printf(u->manager, STATUS_TYPE_NORMAL, status, unit_status_msg_format, d); REENABLE_WARNING; } - int unit_start_limit_test(Unit *u) { const char *reason;