guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

04/04: ui: 'show-manifest-transaction' tabulates package lists for insta


From: guix-commits
Subject: 04/04: ui: 'show-manifest-transaction' tabulates package lists for install/remove.
Date: Tue, 24 Mar 2020 10:44:56 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 8465f1f680ee67c2cca265d1c5871b46284f55f9
Author: Ludovic Courtès <address@hidden>
AuthorDate: Tue Mar 24 14:38:28 2020 +0100

    ui: 'show-manifest-transaction' tabulates package lists for install/remove.
    
    It also removes the store file name from the output.
    
    * guix/ui.scm (show-manifest-transaction)[package-strings]: Rewrite to
    use 'tabulate'.  Remove 'item' parameter and adjust callers.
---
 guix/ui.scm | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/guix/ui.scm b/guix/ui.scm
index 2dd9ba9..1e24fe5 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1144,15 +1144,14 @@ separator between subsequent columns."
 (define* (show-manifest-transaction store manifest transaction
                                     #:key dry-run?)
   "Display what will/would be installed/removed from MANIFEST by TRANSACTION."
-  (define (package-strings name version output item)
-    (map (lambda (name version output item)
-           (format #f "   ~a~:[:~a~;~*~]\t~a\t~a"
-                   name
-                   (equal? output "out") output version
-                   (if (package? item)
-                       (package-output store item output)
-                       item)))
-         name version output item))
+  (define (package-strings names versions outputs)
+    (tabulate (zip (map (lambda (name output)
+                          (if (string=? output "out")
+                              name
+                              (string-append name ":" output)))
+                        names outputs)
+                   versions)
+              #:initial-indent 3))
 
   (define →                        ;an arrow that can be represented on stderr
     (right-arrow (current-error-port)))
@@ -1175,7 +1174,7 @@ separator between subsequent columns."
     (match remove
       ((($ <manifest-entry> name version output item) ..1)
        (let ((len    (length name))
-             (remove (package-strings name version output item)))
+             (remove (package-strings name version output)))
          (if dry-run?
              (format (current-error-port)
                      (N_ "The following package would be removed:~%~{~a~%~}~%"
@@ -1228,7 +1227,7 @@ separator between subsequent columns."
     (match install
       ((($ <manifest-entry> name version output item _) ..1)
        (let ((len     (length name))
-             (install (package-strings name version output item)))
+             (install (package-strings name version output)))
          (if dry-run?
              (format (current-error-port)
                      (N_ "The following package would be 
installed:~%~{~a~%~}~%"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]