ui: Highlight important bits in recutils output.
* guix/scripts/system/search.scm (service-type->recutils): Highlight the value of the 'name' field. * guix/ui.scm (package->recutils): Likewise for 'name' and 'version'.
This commit is contained in:
parent
72298df79d
commit
00dcfb261b
@ -20,7 +20,7 @@
|
|||||||
(define-module (guix scripts system search)
|
(define-module (guix scripts system search)
|
||||||
#:use-module (guix ui)
|
#:use-module (guix ui)
|
||||||
#:use-module (guix utils)
|
#:use-module (guix utils)
|
||||||
#:autoload (guix colors) (supports-hyperlinks?)
|
#:autoload (guix colors) (highlight supports-hyperlinks?)
|
||||||
#:autoload (guix diagnostics) (location->hyperlink)
|
#:autoload (guix diagnostics) (location->hyperlink)
|
||||||
#:use-module (gnu services)
|
#:use-module (gnu services)
|
||||||
#:use-module (gnu services shepherd)
|
#:use-module (gnu services shepherd)
|
||||||
@ -74,6 +74,9 @@ provided TYPE has a default value."
|
|||||||
"Write to PORT a recutils record of TYPE, arranging to fit within WIDTH
|
"Write to PORT a recutils record of TYPE, arranging to fit within WIDTH
|
||||||
columns. When HYPERLINKS? is true, emit hyperlink escape sequences when
|
columns. When HYPERLINKS? is true, emit hyperlink escape sequences when
|
||||||
appropriate."
|
appropriate."
|
||||||
|
(define port*
|
||||||
|
(or (pager-wrapped-port port) port))
|
||||||
|
|
||||||
(define width*
|
(define width*
|
||||||
;; The available number of columns once we've taken into account space for
|
;; The available number of columns once we've taken into account space for
|
||||||
;; the initial "+ " prefix.
|
;; the initial "+ " prefix.
|
||||||
@ -88,7 +91,9 @@ appropriate."
|
|||||||
(string-length "extends: ")))))
|
(string-length "extends: ")))))
|
||||||
|
|
||||||
;; Note: Don't i18n field names so that people can post-process it.
|
;; Note: Don't i18n field names so that people can post-process it.
|
||||||
(format port "name: ~a~%" (service-type-name type))
|
(format port "name: ~a~%"
|
||||||
|
(highlight (symbol->string (service-type-name type))
|
||||||
|
port*))
|
||||||
(format port "location: ~a~%"
|
(format port "location: ~a~%"
|
||||||
(or (and=> (service-type-location type)
|
(or (and=> (service-type-location type)
|
||||||
(if hyperlinks? location->hyperlink location->string))
|
(if hyperlinks? location->hyperlink location->string))
|
||||||
|
@ -1489,6 +1489,9 @@ followed by \"+ \", which makes for a valid multi-line field value in the
|
|||||||
"Write to PORT a `recutils' record of package P, arranging to fit within
|
"Write to PORT a `recutils' record of package P, arranging to fit within
|
||||||
WIDTH columns. EXTRA-FIELDS is a list of symbol/value pairs to emit. When
|
WIDTH columns. EXTRA-FIELDS is a list of symbol/value pairs to emit. When
|
||||||
HYPERLINKS? is true, emit hyperlink escape sequences when appropriate."
|
HYPERLINKS? is true, emit hyperlink escape sequences when appropriate."
|
||||||
|
(define port*
|
||||||
|
(or (pager-wrapped-port port) port))
|
||||||
|
|
||||||
(define width*
|
(define width*
|
||||||
;; The available number of columns once we've taken into account space for
|
;; The available number of columns once we've taken into account space for
|
||||||
;; the initial "+ " prefix.
|
;; the initial "+ " prefix.
|
||||||
@ -1508,8 +1511,8 @@ HYPERLINKS? is true, emit hyperlink escape sequences when appropriate."
|
|||||||
(string<? (package-full-name p1) (package-full-name p2)))
|
(string<? (package-full-name p1) (package-full-name p2)))
|
||||||
|
|
||||||
;; Note: Don't i18n field names so that people can post-process it.
|
;; Note: Don't i18n field names so that people can post-process it.
|
||||||
(format port "name: ~a~%" (package-name p))
|
(format port "name: ~a~%" (highlight (package-name p) port*))
|
||||||
(format port "version: ~a~%" (package-version p))
|
(format port "version: ~a~%" (highlight (package-version p) port*))
|
||||||
(format port "outputs: ~a~%" (string-join (package-outputs p)))
|
(format port "outputs: ~a~%" (string-join (package-outputs p)))
|
||||||
(format port "systems: ~a~%"
|
(format port "systems: ~a~%"
|
||||||
(split-lines (string-join (package-transitive-supported-systems p))
|
(split-lines (string-join (package-transitive-supported-systems p))
|
||||||
|
Loading…
Reference in New Issue
Block a user