diff options
author | Ludovic Courtès <ludo@gnu.org> | 2022-04-09 20:07:17 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2022-04-19 18:07:49 +0200 |
commit | 00dcfb261b207f58d45d6cc542bdcdb0c346598d (patch) | |
tree | 5318df126f8bbceac985d4960c687f218a582033 /guix/scripts/system | |
parent | 72298df79d8b499284f103276b9748377bb3d7de (diff) |
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'.
Diffstat (limited to 'guix/scripts/system')
-rw-r--r-- | guix/scripts/system/search.scm | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/guix/scripts/system/search.scm b/guix/scripts/system/search.scm index 93c9fc5644..2a237e03d9 100644 --- a/guix/scripts/system/search.scm +++ b/guix/scripts/system/search.scm @@ -20,7 +20,7 @@ (define-module (guix scripts system search) #:use-module (guix ui) #:use-module (guix utils) - #:autoload (guix colors) (supports-hyperlinks?) + #:autoload (guix colors) (highlight supports-hyperlinks?) #:autoload (guix diagnostics) (location->hyperlink) #:use-module (gnu services) #: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 columns. When HYPERLINKS? is true, emit hyperlink escape sequences when appropriate." + (define port* + (or (pager-wrapped-port port) port)) + (define width* ;; The available number of columns once we've taken into account space for ;; the initial "+ " prefix. @@ -88,7 +91,9 @@ appropriate." (string-length "extends: "))))) ;; 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~%" (or (and=> (service-type-location type) (if hyperlinks? location->hyperlink location->string)) |