From: Steve Sprang <steve.sprang@gmail.com>
To: 30053@debbugs.gnu.org
Subject: [bug#30053] [PATCH 3/3] Improve appearance of tabular output.
Date: Tue, 9 Jan 2018 14:37:24 -0800 [thread overview]
Message-ID: <CA+xn8YBnEa0qCs_FKn-gCnz0g+UJwy5LziMcDSyzODNMPF_qbQ@mail.gmail.com> (raw)
In-Reply-To: <CA+xn8YBKpjVYmrhKbR7Y=wZnnfr+ALuEMHo_b5AEFMAOTEkDxA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: 0003-ui-Improve-output-appearance-when-listing-generation.patch --]
[-- Type: text/x-patch, Size: 2898 bytes --]
From a4b67e9255ac50750c8f82f6aee8ebc35f8ba2bd Mon Sep 17 00:00:00 2001
From: Steve Sprang <scs@stevesprang.com>
Date: Tue, 9 Jan 2018 14:20:12 -0800
Subject: [PATCH 3/3] ui: Improve output appearance when listing generations.
* guix/ui.scm (display-profile-content-diff): Use pretty-print-table to format output.
(display-profile-content): Likewise.
---
guix/ui.scm | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/guix/ui.scm b/guix/ui.scm
index 895179744..32f618f33 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1334,10 +1334,10 @@ DURATION-RELATION with the current time."
(define (equal-entry? first second)
(string= (manifest-entry-item first) (manifest-entry-item second)))
- (define (display-entry entry prefix)
+ (define (make-row entry prefix)
(match entry
(($ <manifest-entry> name version output location _)
- (format #t " ~a ~a\t~a\t~a\t~a~%" prefix name version output location))))
+ (list (format #f " ~a ~a" prefix name) version output location))))
(define (list-entries number)
(manifest-entries (profile-manifest (generation-file-name profile number))))
@@ -1348,8 +1348,8 @@ DURATION-RELATION with the current time."
equal-entry? (list-entries new) (list-entries old)))
(removed (lset-difference
equal-entry? (list-entries old) (list-entries new))))
- (for-each (cut display-entry <> "+") added)
- (for-each (cut display-entry <> "-") removed)
+ (pretty-print-table (append (map (cut make-row <> "+") added)
+ (map (cut make-row <> "-") removed)))
(newline)))
(display-diff profile gen1 gen2))
@@ -1357,15 +1357,17 @@ DURATION-RELATION with the current time."
(define (display-profile-content profile number)
"Display the packages in PROFILE, generation NUMBER, in a human-readable
way."
- (for-each (match-lambda
- (($ <manifest-entry> name version output location _)
- (format #t " ~a\t~a\t~a\t~a~%"
- name version output location)))
-
- ;; Show most recently installed packages last.
- (reverse
- (manifest-entries
- (profile-manifest (generation-file-name profile number))))))
+
+ (define entry->row
+ (match-lambda
+ (($ <manifest-entry> name version output location _)
+ (list (string-append " " name) version output location))))
+
+ (let* ((manifest (profile-manifest (generation-file-name profile number)))
+ (entries (manifest-entries manifest))
+ (rows (map entry->row entries)))
+ ;; Show most recently installed packages last.
+ (pretty-print-table (reverse rows))))
(define (display-generation-change previous current)
(format #t (G_ "switched from generation ~a to ~a~%") previous current))
--
2.15.1
next prev parent reply other threads:[~2018-01-09 22:38 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-09 22:34 [bug#30053] [PATCH 1/3] Improve appearance of tabular output Steve Sprang
2018-01-09 22:37 ` [bug#30053] [PATCH 2/3] " Steve Sprang
2018-01-09 22:37 ` Steve Sprang [this message]
2018-01-11 21:32 ` [bug#30053] [PATCH 1/3] " Ludovic Courtès
2018-01-11 23:32 ` Steve Sprang
2018-01-12 13:28 ` Roel Janssen
2018-01-13 19:59 ` Steve Sprang
2018-01-16 14:16 ` Ludovic Courtès
2018-01-16 23:56 ` Steve Sprang
2021-07-15 5:39 ` Maxim Cournoyer
2021-07-15 17:36 ` [bug#30053] [PATCH 1/3 v2] " Maxim Cournoyer
2021-07-15 20:15 ` bug#30053: [PATCH 1/3] " Maxim Cournoyer
2021-07-21 16:56 ` [bug#30053] " Ludovic Courtès
2021-07-21 21:43 ` Maxim Cournoyer
2021-07-15 22:05 ` Sarah Morgensen via Guix-patches via
2021-07-16 1:25 ` Maxim Cournoyer
2018-01-12 14:56 ` Danny Milosavljevic
2018-01-12 15:26 ` Leo Famulari
2018-01-12 15:50 ` bug#30087: "guix package -A" hangs with attached package set Danny Milosavljevic
2020-12-03 0:10 ` zimoun
2020-12-22 16:12 ` zimoun
2021-01-11 12:29 ` zimoun
2018-01-13 13:47 ` [bug#30053] [PATCH 1/3] Improve appearance of tabular output Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+xn8YBnEa0qCs_FKn-gCnz0g+UJwy5LziMcDSyzODNMPF_qbQ@mail.gmail.com \
--to=steve.sprang@gmail.com \
--cc=30053@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.