Display the systemctl status in green if state is "running" (#7094)
authorBoucman <jeremy.rosen@enst-bretagne.fr>
Sun, 15 Oct 2017 10:22:47 +0000 (12:22 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 15 Oct 2017 10:22:47 +0000 (12:22 +0200)
src/systemctl/systemctl.c

index 2659835..e4d9ddf 100644 (file)
@@ -5239,11 +5239,13 @@ static int show_system_status(sd_bus *bus) {
         if (streq_ptr(mi.state, "degraded")) {
                 on = ansi_highlight_red();
                 off = ansi_normal();
-        } else if (!streq_ptr(mi.state, "running")) {
+        } else if (streq_ptr(mi.state, "running")) {
+                on = ansi_highlight_green();
+                off = ansi_normal();
+        } else {
                 on = ansi_highlight_yellow();
                 off = ansi_normal();
-        } else
-                on = off = "";
+        }
 
         printf("%s%s%s %s\n", on, special_glyph(BLACK_CIRCLE), off, arg_host ? arg_host : hn);