summaryrefslogtreecommitdiff
path: root/calendar-cli.py
diff options
context:
space:
mode:
authorTobias Brox <tobias@redpill-linpro.com>2015-04-15 21:12:15 +0200
committerTobias Brox <tobias@redpill-linpro.com>2015-04-15 21:12:15 +0200
commit259e1e2dad457a61e28fa6f756afa5c431b6f1ec (patch)
tree8183a456bdba0e4ea7ac9879fb784cb9b39fca6f /calendar-cli.py
parent90b4f04b42e05de644956c10873368738dfa3fa0 (diff)
downloadcalendar-cli-259e1e2dad457a61e28fa6f756afa5c431b6f1ec.zip
date format for agenda printout can be specified through command line options
Diffstat (limited to 'calendar-cli.py')
-rwxr-xr-xcalendar-cli.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/calendar-cli.py b/calendar-cli.py
index af9a482..2f3ece6 100755
--- a/calendar-cli.py
+++ b/calendar-cli.py
@@ -182,7 +182,7 @@ 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:
- event['dstart_sql'] = event['dtstart'].strftime("%F %H:%M")
+ event['dstart'] = event['dtstart'].strftime(args.timestamp_format)
for summary_attr in ('summary', 'location'):
if hasattr(event['instance'], summary_attr):
event['description'] = getattr(event['instance'], summary_attr).value
@@ -268,7 +268,8 @@ 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.add_argument('--event-template', help="Template for printing out the event", default="{dstart} {description}")
+ calendar_agenda_parser.add_argument('--timestamp-format', help="strftime-style format string for the output timestamps", default="%F %H:%M (%a)")
calendar_agenda_parser.set_defaults(func=calendar_agenda)
calendar_delete_parser = calendar_subparsers.add_parser('delete')