diff --git a/README.md b/README.md index 4586480..ab52824 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ There is a "competing" project at https://github.com/geier/khal - you may want t Support ------- -\#calendar-cli at irc.freenode.org, eventually t-calendar-cli@tobixen.no +\#calendar-cli at irc.freenode.org, eventually t-calendar-cli@tobixen.no, eventually the issue tracker at https://github.com/tobixen/calendar-cli/issues Status ------ @@ -125,13 +125,11 @@ Status 2013-12 - 2014-03: helped cyrilrbt on making a new release of the caldav library 2014-03-07: version 0.05 - rewrote parts of the tool to using the caldav library. Nice!!! 2014-03-14: version 0.6 - now agenda works quite smooth. I think this is becoming a useful tool. +2015-02-15: version 0.7 - supports deletion of events, alternative templates for the event output and a small testing script Roadmap ------- * Allow specification of event duration when adding events to calendar -* Delete events. Needed for making a functional test suite. -* Fix a functional test suite. * CLI-interface for creating ical todo events -* Wrap it into an easy-to-install package -* Fix easy-to-use symlinks - +* Fix easy-to-use symlinks (or alternatively wrapper scripts) +* Make some nosetests diff --git a/calendar-cli.py b/calendar-cli.py index f954bd2..af9a482 100755 --- a/calendar-cli.py +++ b/calendar-cli.py @@ -16,7 +16,7 @@ import logging import sys -__version__ = "0.7-devel" +__version__ = "0.7" __author__ = "Tobias Brox" __author_short__ = "tobixen" __copyright__ = "Copyright 2013, Tobias Brox" @@ -182,15 +182,16 @@ def calendar_agenda(caldav_conn, args): events.append({'dtstart': dtstart, 'instance': event}) events.sort(lambda a,b: cmp(a['dtstart'], b['dtstart'])) for event in events: - dtime = event['dtstart'].strftime("%F %H:%M") - summary = "" + event['dstart_sql'] = event['dtstart'].strftime("%F %H:%M") for summary_attr in ('summary', 'location'): if hasattr(event['instance'], summary_attr): - summary = getattr(event['instance'], summary_attr).value + event['description'] = getattr(event['instance'], summary_attr).value break - if hasattr(summary, 'encode'): - summary = summary.encode('utf-8') - print("%s %s") % (dtime, summary) + event['uid'] = event['instance'].uid.value + ## TODO: this will probably break and is probably moot on python3? + if hasattr(event['description'], 'encode'): + event['description'] = event['description'].encode('utf-8') + print(args.event_template.format(**event)) def main(): """ @@ -267,6 +268,7 @@ def main(): calendar_agenda_parser.add_argument('--to-time', help="Fetch calendar until this timestamp") calendar_agenda_parser.add_argument('--agenda-mins', help="Fetch calendar for so many minutes", type=int) calendar_agenda_parser.add_argument('--agenda-days', help="Fetch calendar for so many days", type=int, default=7) + calendar_agenda_parser.add_argument('--event-template', help="Template for printing out the event", default="{dstart_sql} {description}") calendar_agenda_parser.set_defaults(func=calendar_agenda) calendar_delete_parser = calendar_subparsers.add_parser('delete')