ui: Colorize hints.
* guix/ui.scm (%info-colors): Remove CYAN. (%hint-colors): New variable. (display-hint): Adjust so that the "hint:" prefix is colorized.
This commit is contained in:
parent
eff3a9b2dd
commit
a7ae18b1b9
20
guix/ui.scm
20
guix/ui.scm
|
@ -175,8 +175,9 @@ messages."
|
||||||
(exit 1)))
|
(exit 1)))
|
||||||
|
|
||||||
(define %warning-colors '(BOLD MAGENTA))
|
(define %warning-colors '(BOLD MAGENTA))
|
||||||
(define %info-colors '(BOLD CYAN))
|
(define %info-colors '(BOLD))
|
||||||
(define %error-colors '(BOLD RED))
|
(define %error-colors '(BOLD RED))
|
||||||
|
(define %hint-colors '(BOLD CYAN))
|
||||||
|
|
||||||
(define* (print-diagnostic-prefix prefix #:optional location
|
(define* (print-diagnostic-prefix prefix #:optional location
|
||||||
#:key (colors '()))
|
#: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)))
|
(define* (display-hint message #:optional (port (current-error-port)))
|
||||||
"Display MESSAGE, a l10n message possibly containing Texinfo markup, to
|
"Display MESSAGE, a l10n message possibly containing Texinfo markup, to
|
||||||
PORT."
|
PORT."
|
||||||
(format port (G_ "hint: ~a~%")
|
(define colorize
|
||||||
;; XXX: We should arrange so that the initial indent is wider.
|
(if (color-output? port)
|
||||||
(parameterize ((%text-width (max 15
|
(lambda (str)
|
||||||
(- (terminal-columns) 5))))
|
(apply colorize-string str %hint-colors))
|
||||||
(texi->plain-text message))))
|
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)
|
(define* (report-unbound-variable-error args #:key frame)
|
||||||
"Return the given unbound-variable error, where ARGS is the list of 'throw'
|
"Return the given unbound-variable error, where ARGS is the list of 'throw'
|
||||||
|
|
Loading…
Reference in New Issue