diff options
Diffstat (limited to 'calendar-cli.py')
-rwxr-xr-x | calendar-cli.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/calendar-cli.py b/calendar-cli.py index 8961356..ebdb5f8 100755 --- a/calendar-cli.py +++ b/calendar-cli.py @@ -16,7 +16,7 @@ import os import logging import sys -__version__ = "0.6.1" +__version__ = "0.6" __author__ = "Tobias Brox" __author_short__ = "tobixen" __copyright__ = "Copyright 2013, Tobias Brox" @@ -130,11 +130,17 @@ def calendar_agenda(caldav_conn, args): if args.nocaldav: raise ValueError("Agenda with --nocaldav only makes sense together with --icalendar") - dtstart = dateutil.parser.parse(args.from_time) + if args.from_time: + dtstart = dateutil.parser.parse(args.from_time) + else: + dtstart = datetime.now() if args.to_time: dtend = dateutil.parser.parse(args.to_time) - else: - dtend = dtstart + timedelta(1,0) + elif args.agenda_mins: + dtend = dtstart + timedelta(0,0,args.agenda_mins) + elif args.agenda_days: + dtend = dtstart + timedelta(args.agenda_days) + ## TODO: time zone ## No need with "expand" - as for now the method below throws away the expanded data :-( We get a list of URLs, and then we need to do a get on each and one of them ... events_ = find_calendar(caldav_conn, args).date_search(dtstart, dtend) @@ -228,8 +234,10 @@ def main(): calendar_addics_parser.set_defaults(func=calendar_addics) calendar_agenda_parser = calendar_subparsers.add_parser('agenda') - calendar_agenda_parser.add_argument('from_time', help="Fetch calendar events from this timestamp. See the documentation for time specifications") + calendar_agenda_parser.add_argument('--from-time', help="Fetch calendar events from this timestamp. See the documentation for time specifications. Defaults to now") 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.set_defaults(func=calendar_agenda) todo_parser = subparsers.add_parser('todo') |