Re: How to format CLI tabular data?

From: Date: Tue, 09 Oct 2007 13:15:50 +0000
Subject: Re: How to format CLI tabular data?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-262957@lists.php.net to get a copy of this message
At 3:59 PM -0700 10/8/07, Daevid Vincent wrote:
I write many CLI scripts in PHP to clean up DB records, etc via crontab scripts. Often though, I implement command line switches to 'debug' or see various data as a precaution before actually purging. Perl has some neat tools built in to format tabular data: http://www.usenix.org/publications/perl/perl08.html Does PHP have any tools like this? I'd prefer not to pull in some PEAR package or other bloat, but I'll take what I can get if it actually works well. I was hoping there are some tips/tricks to show simple tabular data: i.e.: # foo.php --showgroups ==================================
              Groups
==================================
Name:     Expires:     Date:
-------- ------------ -----------
groupA        3 hours   2007-10-08
groupBeta    10 hours   2007-11-10
groupC        1 week    2007-12-31
notice basic things like alignment, length of data (as in 'tabs' won't work), etc.
It's tabular -- why not use tables? Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com

« previous php.general (#262957) next »