[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/09: ui: Colorize hints.
From: |
guix-commits |
Subject: |
01/09: ui: Colorize hints. |
Date: |
Wed, 10 Apr 2019 11:17:49 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit a7ae18b1b9a083a1fbc6c2037e45df2447f704ed
Author: Ludovic Courtès <address@hidden>
Date: Wed Apr 10 12:55:23 2019 +0200
ui: Colorize hints.
* guix/ui.scm (%info-colors): Remove CYAN.
(%hint-colors): New variable.
(display-hint): Adjust so that the "hint:" prefix is colorized.
---
guix/ui.scm | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/guix/ui.scm b/guix/ui.scm
index 3869f77..63977f3 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -175,8 +175,9 @@ messages."
(exit 1)))
(define %warning-colors '(BOLD MAGENTA))
-(define %info-colors '(BOLD CYAN))
+(define %info-colors '(BOLD))
(define %error-colors '(BOLD RED))
+(define %hint-colors '(BOLD CYAN))
(define* (print-diagnostic-prefix prefix #:optional location
#:key (colors '()))
@@ -357,11 +358,18 @@ VARIABLE and return it, or #f if none was found."
(define* (display-hint message #:optional (port (current-error-port)))
"Display MESSAGE, a l10n message possibly containing Texinfo markup, to
PORT."
- (format port (G_ "hint: ~a~%")
- ;; XXX: We should arrange so that the initial indent is wider.
- (parameterize ((%text-width (max 15
- (- (terminal-columns) 5))))
- (texi->plain-text message))))
+ (define colorize
+ (if (color-output? port)
+ (lambda (str)
+ (apply colorize-string str %hint-colors))
+ identity))
+
+ (display (colorize (G_ "hint: ")) port)
+ (display
+ ;; XXX: We should arrange so that the initial indent is wider.
+ (parameterize ((%text-width (max 15 (- (terminal-columns) 5))))
+ (texi->plain-text message))
+ port))
(define* (report-unbound-variable-error args #:key frame)
"Return the given unbound-variable error, where ARGS is the list of 'throw'
- branch master updated (eff3a9b -> 3e4e74c), guix-commits, 2019/04/10
- 04/09: Add (guix store roots)., guix-commits, 2019/04/10
- 02/09: ui: Highlight diagnostic format string arguments., guix-commits, 2019/04/10
- 01/09: ui: Colorize hints.,
guix-commits <=
- 08/09: scripts: GC hint suggests 'guix gc -d 1m'., guix-commits, 2019/04/10
- 07/09: guix gc: Add '--delete-generations'., guix-commits, 2019/04/10
- 05/09: guix gc: Add '--list-roots'., guix-commits, 2019/04/10
- 03/09: pull: Remove duplicate '--dry-run' description., guix-commits, 2019/04/10
- 09/09: gnu: kodi: Allow connecting to HTTPS sources., guix-commits, 2019/04/10
- 06/09: profiles: Add 'generation-profile'., guix-commits, 2019/04/10