civodul pushed a commit to branch devel
in repository shepherd.

commit d810afe8cb329ea61190d984189093ed30eec3ca
Author: Ludovic Courtès <l...@gnu.org>
AuthorDate: Sat Aug 17 18:23:42 2024 +0200

    herd: Display a colored bullet for the overall status.
    
    * modules/shepherd/scripts/herd.scm (display-service-status): When the
    current output port is UTF-8-encoded, display a colored bullet for the
    overall status.
---
 modules/shepherd/scripts/herd.scm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/modules/shepherd/scripts/herd.scm 
b/modules/shepherd/scripts/herd.scm
index a6ec6c0..02545be 100644
--- a/modules/shepherd/scripts/herd.scm
+++ b/modules/shepherd/scripts/herd.scm
@@ -376,6 +376,15 @@ calendar event."
   "Display the status of @var{service}, an sexp.  When
 @var{show-recent-messages?} is true, display messages recently logged by
 @var{service}."
+  (when (string=? (port-encoding (current-output-port)) "UTF-8")
+    ;; Show a colored bullet that gives an idea of the overall status.
+    (display ((if (eq? (live-service-status service) 'running)
+                  highlight/success
+                  (if (live-service-enabled? service)
+                      highlight/warn
+                      highlight/error))
+              "● ")))
+
   (format #t (highlight (l10n "Status of ~a:~%"))
           (live-service-canonical-name service))
 

Reply via email to