diagnostics: Avoid highlighting complete messages.

* guix/diagnostics.scm (%highlight-argument): Don't highlight ARG if it
contains white space.
This commit is contained in:
Ludovic Courtès 2019-08-28 18:00:42 +02:00
parent 8f67a76a54
commit d229215051
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 6 additions and 1 deletions

View File

@ -71,7 +71,12 @@ is a trivial format string."
(define* (%highlight-argument arg #:optional (port (guix-warning-port))) (define* (%highlight-argument arg #:optional (port (guix-warning-port)))
"Highlight ARG, a format string argument, if PORT supports colors." "Highlight ARG, a format string argument, if PORT supports colors."
(cond ((string? arg) (cond ((string? arg)
(highlight arg port)) ;; If ARG contains white space, don't highlight it, on the grounds
;; that it may be a complete message in its own, like those produced
;; by 'guix lint.
(if (string-any char-set:whitespace arg)
arg
(highlight arg port)))
((symbol? arg) ((symbol? arg)
(highlight (symbol->string arg) port)) (highlight (symbol->string arg) port))
(else arg))) (else arg)))