guix-commits
[Top][All Lists]
Advanced

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

02/02: ui: Lexicographically sort transaction entries based on their pac


From: guix-commits
Subject: 02/02: ui: Lexicographically sort transaction entries based on their package name.
Date: Sat, 12 Sep 2020 02:12:04 -0400 (EDT)

apteryx pushed a commit to branch master
in repository guix.

commit 140da556be06442192fbae5e2a07357f26fbc26b
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Wed Sep 2 13:08:46 2020 -0400

    ui: Lexicographically sort transaction entries based on their package name.
    
    * guix/ui.scm (show-manifest-transaction): Sort entries to be displayed in a
    tabulated view.
---
 guix/ui.scm | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/guix/ui.scm b/guix/ui.scm
index 9c641af..115d980 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1240,18 +1240,21 @@ separator between subsequent columns."
                                     #:key dry-run?)
   "Display what will/would be installed/removed from MANIFEST by TRANSACTION."
   (define* (package-strings names versions outputs #:key old-versions)
-    (tabulate (zip (map (lambda (name output)
-                          (if (string=? output "out")
-                              name
-                              (string-append name ":" output)))
-                        names outputs)
-                   (if old-versions
-                       (map (lambda (old new)
-                          (if (string=? old new)
-                              (G_ "(dependencies or package changed)")
-                              (string-append old " " → " " new)))
-                            old-versions versions)
-                       versions))
+    (tabulate (stable-sort
+               (zip (map (lambda (name output)
+                           (if (string=? output "out")
+                               name
+                               (string-append name ":" output)))
+                         names outputs)
+                    (if old-versions
+                        (map (lambda (old new)
+                               (if (string=? old new)
+                                   (G_ "(dependencies or package changed)")
+                                   (string-append old " " → " " new)))
+                             old-versions versions)
+                        versions))
+               (lambda (x y)
+                 (string<? (first x) (first y))))
               #:initial-indent 3))
 
   (define →                        ;an arrow that can be represented on stderr



reply via email to

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