guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#53909] [PATCH 3/4] ui: 'display-generation' uses color when talking


From: Ludovic Courtès
Subject: [bug#53909] [PATCH 3/4] ui: 'display-generation' uses color when talking to a pager.
Date: Wed, 9 Feb 2022 23:17:11 +0100

This makes sure that, say, 'guix pull -l' benefits from colors when its
output is piped to a pager, as long as the underlying terminal supports
it.

* guix/ui.scm (display-generation): Add second argument to 'highlight'.
---
 guix/ui.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/guix/ui.scm b/guix/ui.scm
index d1f92ce7be..238952723e 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1900,7 +1900,9 @@ (define (display-generation profile number)
            (link   (if (supports-hyperlinks?)
                        (cut file-hyperlink file <>)
                        identity))
-           (header (format #f (link (highlight (G_ "Generation ~a\t~a")))
+           (header (format #f (link (highlight (G_ "Generation ~a\t~a")
+                                               (or (pager-wrapped-port)
+                                                   (current-output-port))))
                            number
                            (date->string
                             (time-utc->date
-- 
2.34.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]