diff options
author | Ludovic Courtès <ludo@gnu.org> | 2022-02-09 22:23:27 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2022-02-14 15:52:36 +0100 |
commit | 5b6e31b020678dbbc289479b8ff1853c3fbd2085 (patch) | |
tree | 8960836e180b928a0ea893e365137713f3f4878a | |
parent | 7ffcee1937671cbb318491076164fba4ef0b109c (diff) |
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'.
-rw-r--r-- | guix/ui.scm | 4 |
1 files changed, 3 insertions, 1 deletions
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 |