From: Steve Sprang <steve.sprang@gmail.com>
To: 30053@debbugs.gnu.org
Subject: [bug#30053] [PATCH 2/3] Improve appearance of tabular output.
Date: Tue, 9 Jan 2018 14:37:02 -0800 [thread overview]
Message-ID: <CA+xn8YBAvzHe57HEGDcFGKTVeXcx=nA7Rsg31ghWLL6_ujJufg@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: 0002-package-Improve-output-appearance-when-listing-packa.patch --]
[-- Type: text/x-patch, Size: 3042 bytes --]
From c3454179249c84651f50fdfb88950b66f5760923 Mon Sep 17 00:00:00 2001
From: Steve Sprang <scs@stevesprang.com>
Date: Tue, 9 Jan 2018 14:10:04 -0800
Subject: [PATCH 2/3] package: Improve output appearance when listing packages.
* guix/scripts/package.scm (process-query): Use pretty-print-table when listing installed and available packages.
---
guix/scripts/package.scm | 37 ++++++++++++++++++-------------------
1 file changed, 18 insertions(+), 19 deletions(-)
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 617e102d9..ced85f850 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -723,15 +723,14 @@ processed, #f otherwise."
(manifest (profile-manifest profile))
(installed (manifest-entries manifest)))
(leave-on-EPIPE
- (for-each (match-lambda
- (($ <manifest-entry> name version output path _)
- (when (or (not regexp)
- (regexp-exec regexp name))
- (format #t "~a\t~a\t~a\t~a~%"
- name (or version "?") output path))))
-
- ;; Show most recently installed packages last.
- (reverse installed)))
+ (let ((rows (filter-map
+ (match-lambda
+ (($ <manifest-entry> name version output path _)
+ (and (regexp-exec regexp name)
+ (list name (or version "?") output path))))
+ installed)))
+ ;; Show most recently installed packages last.
+ (pretty-print-table (reverse rows))))
#t))
(('list-available regexp)
@@ -749,16 +748,16 @@ processed, #f otherwise."
r)))
'())))
(leave-on-EPIPE
- (for-each (lambda (p)
- (format #t "~a\t~a\t~a\t~a~%"
- (package-name p)
- (package-version p)
- (string-join (package-outputs p) ",")
- (location->string (package-location p))))
- (sort available
- (lambda (p1 p2)
- (string<? (package-name p1)
- (package-name p2))))))
+ (let ((rows (map (lambda (p)
+ (list (package-name p)
+ (package-version p)
+ (string-join (package-outputs p) ",")
+ (location->string (package-location p))))
+ (sort available
+ (lambda (p1 p2)
+ (string<? (package-name p1)
+ (package-name p2)))))))
+ (pretty-print-table rows)))
#t))
(('search _)
--
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 ` Steve Sprang [this message]
2018-01-09 22:37 ` [bug#30053] [PATCH 3/3] " Steve Sprang
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+xn8YBAvzHe57HEGDcFGKTVeXcx=nA7Rsg31ghWLL6_ujJufg@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.