guix-commits
[Top][All Lists]
Advanced

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

02/06: pull: Factorize pretty-printing for new/upgraded package lists.


From: guix-commits
Subject: 02/06: pull: Factorize pretty-printing for new/upgraded package lists.
Date: Thu, 28 Mar 2019 18:07:57 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 9f4169f6c8014206ea389e1ded88622fa6cfbe4a
Author: Ludovic Courtès <address@hidden>
Date:   Thu Mar 28 15:55:47 2019 +0100

    pull: Factorize pretty-printing for new/upgraded package lists.
    
    * guix/scripts/pull.scm (display-new/upgraded-packages)[pretty]: New
    procedure.
    Use it.
---
 guix/scripts/pull.scm | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 730b6a0..e06ec2f 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -382,6 +382,11 @@ of packages upgraded in ALIST2."
   "Given the two package name/version alists ALIST1 and ALIST2, display the
 list of new and upgraded packages going from ALIST1 to ALIST2.  When ALIST1
 and ALIST2 differ, display HEADING upfront."
+  (define (pretty str column)
+    (indented-string (fill-paragraph str (- (%text-width) 4)
+                                     column)
+                     4))
+
   (let-values (((new upgraded) (new/upgraded-packages alist1 alist2)))
     (unless (and (null? new) (null? upgraded))
       (display heading))
@@ -392,21 +397,17 @@ and ALIST2 differ, display HEADING upfront."
        (format #t (N_ "  ~h new package: ~a~%"
                       "  ~h new packages: ~a~%" count)
                count
-               (indented-string
-                (fill-paragraph (string-join (sort (map first new) string<?)
-                                             ", ")
-                                (- (%text-width) 4) 30)
-                4))))
+               (pretty (string-join (sort (map first new) string<?)
+                                    ", ")
+                       30))))
     (match (length upgraded)
       (0 #t)
       (count
        (format #t (N_ "  ~h package upgraded: ~a~%"
                       "  ~h packages upgraded: ~a~%" count)
                count
-               (indented-string
-                (fill-paragraph (string-join (sort upgraded string<?) ", ")
-                                (- (%text-width) 4) 35)
-                4))))))
+               (pretty (string-join (sort upgraded string<?) ", ")
+                       35))))))
 
 (define (display-profile-content-diff profile gen1 gen2)
   "Display the changes in PROFILE GEN2 compared to generation GEN1."



reply via email to

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