guix-patches
[Top][All Lists]
Advanced

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

[bug#30053] [PATCH 1/3] Improve appearance of tabular output.


From: Ludovic Courtès
Subject: [bug#30053] [PATCH 1/3] Improve appearance of tabular output.
Date: Wed, 21 Jul 2021 18:56:30 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hi Maxim and all,

Thank you for unlocking this old patch series.  :-)

Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

>>From d8fd6c9a1b8677cd69e50fe4f3e50c60c5fb7e35 Mon Sep 17 00:00:00 2001
> From: Steve Sprang <scs@stevesprang.com>
> Date: Tue, 9 Jan 2018 14:00:11 -0800
> Subject: [PATCH] utils: Add a procedure for pretty printing tabular data.
>
> * guix/utils.scm (pretty-print-table): New procedure.
>
> Co-authored-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
> Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>

[...]

> +(define* (pretty-print-table rows #:key (max-column-width 20))
> +  "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."

The version that was pushed has:

  (setvbuf (current-output-port) 'block)

I’m in favor of removing it because it’s “impolite” so to speak :-) to
have such a side effect buried here.  (guix ui) enables line-buffering
on startup anyway.

Ludo’.

PS: Commit 01d7e8c2782f61e741f8beff7888adfbdb61779d shows an
    incompatibility with some previously-fine uses of ‘cut’, but surely
    that was the price to pay.  (An option would be to behave
    differently depending on whether stdout is a tty or not, but that’s
    probably bad style…)





reply via email to

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