Re: How to format CLI tabular data?
| From: | Robert Cummings | Date: | Tue, 09 Oct 2007 03:14:18 +0000 |
| Subject: | Re: How to format CLI tabular data? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-262946@lists.php.net to get a copy of this message | ||
On Mon, 2007-10-08 at 15:59 -0700, 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.
Looks like something you could whip up in half an hour.
Cheers,
Rob.
--
...........................................................
SwarmBuy.com - http://www.swarmbuy.com
Leveraging the buying power of the masses!
...........................................................