ui: Improve formatting of package dependencies in recutils.
authorLudovic Courtès <ludo@gnu.org>
Thu, 24 Jul 2014 22:29:47 +0000 (00:29 +0200)
committerLudovic Courtès <ludo@gnu.org>
Thu, 24 Jul 2014 22:29:47 +0000 (00:29 +0200)
* guix/ui.scm (package->recutils)[dependencies->recutils]: New
  procedure. Use it.

guix/ui.scm

index 74ea20e..1b7d334 100644 (file)
@@ -453,6 +453,13 @@ WIDTH columns."
        (fill-paragraph str width
                        (string-length "description: ")))))
 
+  (define (dependencies->recutils packages)
+    (let ((list (string-join (map package-full-name
+                                  (sort packages package<?)) " ")))
+      (string->recutils
+       (fill-paragraph list width
+                       (string-length "dependencies: ")))))
+
   (define (package<? p1 p2)
     (string<? (package-full-name p1) (package-full-name p2)))
 
@@ -462,8 +469,7 @@ WIDTH columns."
   (format port "dependencies: ~a~%"
           (match (package-direct-inputs p)
             (((labels packages . _) ...)
-             (string-join (map package-full-name
-                               (sort packages package<?)) ", "))))
+             (dependencies->recutils packages))))
   (format port "location: ~a~%"
           (or (and=> (package-location p) location->string)
               (_ "unknown")))