all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 54307@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#54307] [PATCH 1/2] ui: 'show-what-to-build' highlights "The following [...] will be built".
Date: Wed,  9 Mar 2022 11:12:33 +0100	[thread overview]
Message-ID: <20220309101234.24236-1-ludo@gnu.org> (raw)
In-Reply-To: <20220309095710.23849-1-ludo@gnu.org>

* guix/colors.scm (highlight/warn): New procedure.
* guix/ui.scm (show-what-to-build): Use 'highlight/warn' when displaying
what would/will be built.
---
 guix/colors.scm |  4 +++-
 guix/ui.scm     | 24 ++++++++++++++----------
 2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/guix/colors.scm b/guix/colors.scm
index 3031f54799..ae0a583d94 100644
--- a/guix/colors.scm
+++ b/guix/colors.scm
@@ -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 @@ (define-module (guix colors)
 
             colorize-string
             highlight
+            highlight/warn
             dim
 
             color-rules
@@ -143,6 +144,7 @@ (define (coloring-procedure color)
         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)
diff --git a/guix/ui.scm b/guix/ui.scm
index 238952723e..8e4e3e2dfc 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1031,12 +1031,14 @@ (define display-download-size?
     ;; 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 @@ (define display-download-size?
                              (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)
-- 
2.34.0





  reply	other threads:[~2022-03-09 10:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-09  9:57 [bug#54307] [PATCH 0/2] Highlight headings showing what to build/download Ludovic Courtès
2022-03-09 10:12 ` Ludovic Courtès [this message]
2022-03-09 10:12   ` [bug#54307] [PATCH 2/2] ui: 'show-what-to-build' highlights "would be downloaded" headings Ludovic Courtès
2022-03-09 10:52   ` [bug#54307] [PATCH 1/2] ui: 'show-what-to-build' highlights "The following [...] will be built" Liliana Marie Prikler
2022-03-10 10:19     ` [bug#54307] [PATCH 0/2] Highlight headings showing what to build/download Ludovic Courtès
2022-03-10 10:46       ` Liliana Marie Prikler
2022-03-13 22:00         ` Ludovic Courtès
2022-03-18 15:10 ` bug#54307: " 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=20220309101234.24236-1-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=54307@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.