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/ui.scm | |
parent | 72298df79d8b499284f103276b9748377bb3d7de (diff) | |
download | guix-patches-00dcfb261b207f58d45d6cc542bdcdb0c346598d.tar guix-patches-00dcfb261b207f58d45d6cc542bdcdb0c346598d.tar.gz |
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/ui.scm')
-rw-r--r-- | guix/ui.scm | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/guix/ui.scm b/guix/ui.scm index 37d24030e4..555a614faa 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -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 WIDTH columns. EXTRA-FIELDS is a list of symbol/value pairs to emit. 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. @@ -1508,8 +1511,8 @@ HYPERLINKS? is true, emit hyperlink escape sequences when appropriate." (string<? (package-full-name p1) (package-full-name p2))) ;; Note: Don't i18n field names so that people can post-process it. - (format port "name: ~a~%" (package-name p)) - (format port "version: ~a~%" (package-version p)) + (format port "name: ~a~%" (highlight (package-name p) port*)) + (format port "version: ~a~%" (highlight (package-version p) port*)) (format port "outputs: ~a~%" (string-join (package-outputs p))) (format port "systems: ~a~%" (split-lines (string-join (package-transitive-supported-systems p)) |