all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 53909@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
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	[thread overview]
Message-ID: <20220209221712.8724-3-ludo@gnu.org> (raw)
In-Reply-To: <20220209221712.8724-1-ludo@gnu.org>

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





  parent reply	other threads:[~2022-02-09 22:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09 22:12 [bug#53909] [PATCH 0/4] 'guix pull -l' no longer displays package lists by default Ludovic Courtès
2022-02-09 22:17 ` [bug#53909] [PATCH 1/4] pull: '--list-generations' doesn't list package changes " Ludovic Courtès
2022-02-09 22:17   ` [bug#53909] [PATCH 2/4] ui: 'with-paginated-output-port' gives access to the wrapped port Ludovic Courtès
2022-02-09 22:17   ` Ludovic Courtès [this message]
2022-02-09 22:17   ` [bug#53909] [PATCH 4/4] pull: '--list-generations' pipes its output to the pager Ludovic Courtès
2022-02-10 17:21   ` [bug#53909] [PATCH 0/4] 'guix pull -l' no longer displays package lists by default zimoun
2022-02-14 14:56     ` bug#53909: " Ludovic Courtès
2022-02-14 17:28       ` [bug#53909] " zimoun
2022-02-10 17:51 ` zimoun
2022-02-14 12:56   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220209221712.8724-3-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=53909@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.