From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36550) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZzPM-0002US-9D for guix-patches@gnu.org; Fri, 12 Jan 2018 08:30:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eZzPH-0006zr-7t for guix-patches@gnu.org; Fri, 12 Jan 2018 08:30:08 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:45100) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eZzPH-0006zm-4X for guix-patches@gnu.org; Fri, 12 Jan 2018 08:30:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eZzPG-0005uW-Sg for guix-patches@gnu.org; Fri, 12 Jan 2018 08:30:02 -0500 Subject: [bug#30053] [PATCH 1/3] Improve appearance of tabular output. Resent-Message-ID: References: <878td4nksy.fsf@gnu.org> From: Roel Janssen In-reply-to: Date: Fri, 12 Jan 2018 14:28:30 +0100 Message-ID: <87fu7b2old.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Steve Sprang Cc: 30053@debbugs.gnu.org Steve Sprang writes: > Hi Ludovic, > > On Thu, Jan 11, 2018 at 1:32 PM, Ludovic Courtès wrote: >> Long time no see! ;-) > > Yeah, it's been a while! > >> I have a disappointing explanation I’m afraid: the reason columns look >> this way is because they are tab-separated, which in turn makes it easy >> to filter with ‘cut’: >> >> --8<---------------cut here---------------start------------->8--- >> $ guix package -A | cut -f1 | head >> 0ad >> 0ad-data >> 0xffff >> 4store >> 4ti2 >> a2ps >> aalib >> abbaye >> abc >> abcde >> --8<---------------cut here---------------end--------------->8--- > > I'm still inserting a tab between columns, so I believe 'cut' still > works as expected in this case. Initially, I was separating columns > with a few spaces, but that broke some of the tests that were relying > on cut, so I switched back to tab. > >> An example from the manual (info "(guix) Invoking guix build"): >> >> guix build --quiet --keep-going \ >> `guix package -A | cut -f1,2 --output-delimiter=@` > > Argh, this use case fails because of the extra inserted whitespace. > >> The idea was to have this shell-scripting-friendly format, and to >> provide fancier output in other commands, such as --search (which is in >> fact script-friendly as well thanks to recutils). >> >> Silly? Awesome? Ugly? What do people think? :-) > > Another potential drawback of this patch is that it tends to make > output lines longer than before. This might make line-wrapping less > pleasant when using smaller terminal windows/screens. > > -Steve If we use GNU awk instead of cut, I think any whitespace will work: $ guix package -A | awk '{ print $1 "@" $2 }' And then we can optimize the output reading experience for our users instead of for the 'cut' program. Kind regards, Roel Janssen