GNU bug report logs - #54307
[PATCH 0/2] Highlight headings showing what to build/download

Previous Next

Package: guix-patches;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Wed, 9 Mar 2022 09:58:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: 54307 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> 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
* 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 <at> swecha.net>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado <at> elephly.net>
-;;; Copyright © 2017, 2018, 2019 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2017, 2018, 2019, 2022 Ludovic Courtès <ludo <at> 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





This bug report was last modified 3 years and 65 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.