diff options
author | Tobias Brox <tobias@redpill-linpro.com> | 2016-04-20 13:35:56 +0200 |
---|---|---|
committer | Tobias Brox <tobias@redpill-linpro.com> | 2016-04-20 13:35:56 +0200 |
commit | 47bd4b078b93815b745725ad5bd353772febf43c (patch) | |
tree | 5ebe937a51cccaeb64ceaf33717582df1765fdd9 | |
parent | 57e7f61f53d671360625ef6940a32a6cfb696557 (diff) | |
parent | d1b513102ab7c3c6b5cf9b243eb31fe4c9d5f0e2 (diff) | |
download | calendar-cli-47bd4b078b93815b745725ad5bd353772febf43c.zip |
Merge branch 'fgtham-cal_opts' into v0.11.0.dev
-rwxr-xr-x | calendar-cli.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/calendar-cli.py b/calendar-cli.py index 860072b..bec67aa 100755 --- a/calendar-cli.py +++ b/calendar-cli.py @@ -81,6 +81,8 @@ time_units = { vtodo_txt_one = ['location', 'description', 'geo', 'organizer', 'summary'] vtodo_txt_many = ['categories', 'comment', 'contact', 'resources'] +vcal_txt_one = ['location', 'description'] +vcal_txt_many = [] def niy(*args, **kwargs): if 'feature' in kwargs: @@ -285,6 +287,12 @@ def calendar_add(caldav_conn, args): ## maybe we should generate some uid? uid = uuid.uuid1() event.add('uid', str(uid)) + for attr in vcal_txt_one + vcal_txt_many: + if attr == 'summary': + continue + val = getattr(args, 'set_'+attr) + if val: + event.add(attr, val) event.add('summary', ' '.join(args.summary)) cal.add_component(event) _calendar_addics(caldav_conn, cal.to_ical(), uid, args) @@ -810,6 +818,10 @@ def main(): calendar_add_parser.add_argument('event_time', help="Timestamp and duration of the event. See the documentation for event_time specifications") calendar_add_parser.add_argument('summary', nargs='+') calendar_add_parser.set_defaults(func=calendar_add) + + for attr in vcal_txt_one + vcal_txt_many: + calendar_add_parser.add_argument('--set-'+attr, help='Set '+attr) + calendar_addics_parser = calendar_subparsers.add_parser('addics') calendar_addics_parser.add_argument('--file', help="ICS file to upload", default='-') calendar_addics_parser.set_defaults(func=calendar_addics) |