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'.
This commit is contained in:
Ludovic Courtès 2022-02-09 22:23:27 +01:00
parent 7ffcee1937
commit 5b6e31b020
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 3 additions and 1 deletions

View File

@ -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