insanum/gcalcli — pull request #76 by ernierasta (2013-03-17 15:36:56+00:00)
Title: Added --format option used with import -v

Overview:
------------
Added option to change import -v output. Predefined are 3 formats [old, compact, fancy]. Default is old.

Description:
--------------
My idea was not to only improve output, but allow easy import output templating.

I tried to minimize changes, so:
- added flag format and its validation
- added format parameter to ImportICS
- added 3 functions: `PrintEvent, SetHeaders, P_CompactDate`
* `SetHeaders` - this function simply just create tuple of tuples which defines output format. It allows string formating, custom order, ... it is described in function comment.
* `PrintEvent` - this function parses SetHeaders output and prints everything on screen. It allows to easy implement hooks if ordinary string and variable formating is not enough.
* `P_CompactDate` - this is helper function, generally example have to implement such function. This one implements start&end date consolidation.

It works as it is, i tried to show some possibilities in defined formats, but it is intended to be extended in future. I also think, that it should be quite easy to read format from external file if this option would be useful.