summary refs log tree commit diff
path: root/guix/utils.scm
diff options
context:
space:
mode:
authorAntero Mejr <antero@mailbox.org>2022-07-12 22:50:07 +0000
committerLudovic Courtès <ludo@gnu.org>2022-07-19 18:54:42 +0200
commit55725724dd0891e1e195158d0774a3f9a8619361 (patch)
tree07a32b77bf7c351375383621a07934e3cfd00c13 /guix/utils.scm
parent18bb89c2b2ce30dbdbcee9586f9938c6abe6c7ef (diff)
downloadguix-55725724dd0891e1e195158d0774a3f9a8619361.tar.gz
home: Add -I, --list-installed option.
* guix/scripts/package.scm (list-installed): New procedure.
* guix/scripts/home.scm (%options, show-help): Add '--list-installed'.
(process-command): For 'describe' and 'list-generations', honor the
'list-installed option.
(display-home-environment-generation): Add #:list-installed-regex and
honor it.
(list-generations): Likewise.
* guix/scripts/utils.scm (pretty-print-table): New argument "left-pad".
* doc/guix.texi (Invoking Guix Home): Add information and example for
--list-installed flag.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'guix/utils.scm')
-rw-r--r--guix/utils.scm6
1 files changed, 3 insertions, 3 deletions
diff --git a/guix/utils.scm b/guix/utils.scm
index 745da98a79..329ef62dde 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -1124,11 +1124,11 @@ according to THRESHOLD, then #f is returned."
 ;;; Prettified output.
 ;;;
 
-(define* (pretty-print-table rows #:key (max-column-width 20))
+(define* (pretty-print-table rows #:key (max-column-width 20) (left-pad 0))
   "Print ROWS in neat columns.  All rows should be lists of strings and each
 row should have the same length.  The columns are separated by a tab
 character, and aligned using spaces.  The maximum width of each column is
-bound by MAX-COLUMN-WIDTH."
+bound by MAX-COLUMN-WIDTH.  Each row is prefixed with LEFT-PAD spaces."
   (let* ((number-of-columns-to-pad (if (null? rows)
                                        0
                                        (1- (length (first rows)))))
@@ -1143,7 +1143,7 @@ bound by MAX-COLUMN-WIDTH."
                               (map (cut min <> max-column-width)
                                    column-widths)))
          (fmt (string-append (string-join column-formats "\t") "\t~a")))
-    (for-each (cut format #t "~?~%" fmt <>) rows)))
+    (for-each (cut format #t "~v_~?~%" left-pad fmt <>) rows)))
 
 ;;; Local Variables:
 ;;; eval: (put 'call-with-progress-reporter 'scheme-indent-function 1)