ui: 'show-what-to-build' highlights "The following [...] will be built".

* guix/colors.scm (highlight/warn): New procedure.
* guix/ui.scm (show-what-to-build): Use 'highlight/warn' when displaying
what would/will be built.
This commit is contained in:
Ludovic Courtès 2022-03-09 10:36:28 +01:00
parent 2da0f2828b
commit 9e0f0123a0
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 17 additions and 11 deletions

View File

@ -2,7 +2,7 @@
;;; Copyright © 2013, 2014 Free Software Foundation, Inc.
;;; Copyright © 2018 Sahithi Yarlagadda <sahi@swecha.net>
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017, 2018, 2019, 2022 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@ -31,6 +31,7 @@
colorize-string
highlight
highlight/warn
dim
color-rules
@ -143,6 +144,7 @@ that subsequent output will not have any colors in effect."
str)))
(define highlight (coloring-procedure (color BOLD)))
(define highlight/warn (coloring-procedure (color BOLD MAGENTA)))
(define dim (coloring-procedure (color DARK)))
(define (colorize-matches rules)

View File

@ -1031,12 +1031,14 @@ summary, and level 0 shows nothing."
;; Unfortunately, this is hardly avoidable for proper i18n.
(if dry-run?
(begin
(unless (zero? verbosity)
(unless (or (zero? verbosity) (null? build))
(format (current-error-port)
(N_ "~:[The following derivation would be built:~%~{ ~a~%~}~;~]"
"~:[The following derivations would be built:~%~{ ~a~%~}~;~]"
(length build))
(null? build) (map colorized-store-item build)))
(highlight/warn
(N_ "The following derivation would be built:~%"
"The following derivations would be built:~%"
(length build))))
(format (current-error-port) "~{ ~a~%~}"
(map colorized-store-item build)))
(cond ((>= verbosity 2)
(if display-download-size?
(format (current-error-port)
@ -1082,12 +1084,14 @@ summary, and level 0 shows nothing."
(null? download) (length download))))))
(begin
(unless (zero? verbosity)
(unless (or (zero? verbosity) (null? build))
(format (current-error-port)
(N_ "~:[The following derivation will be built:~%~{ ~a~%~}~;~]"
"~:[The following derivations will be built:~%~{ ~a~%~}~;~]"
(length build))
(null? build) (map colorized-store-item build)))
(highlight/warn
(N_ "The following derivation will be built:~%"
"The following derivations will be built:~%"
(length build))))
(format (current-error-port) "~{ ~a~%~}"
(map colorized-store-item build)))
(cond ((>= verbosity 2)
(if display-download-size?
(format (current-error-port)