guix-commits
[Top][All Lists]
Advanced

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

08/16: ui: 'display-generation' uses color when talking to a pager.


From: guix-commits
Subject: 08/16: ui: 'display-generation' uses color when talking to a pager.
Date: Mon, 14 Feb 2022 09:53:40 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 5b6e31b020678dbbc289479b8ff1853c3fbd2085
Author: Ludovic Court├Ęs <ludo@gnu.org>
AuthorDate: Wed Feb 9 22:23:27 2022 +0100

    ui: 'display-generation' uses color when talking to a pager.
    
    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 @@ DURATION-RELATION with the current time."
            (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



reply via email to

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