summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcos <cos>2021-05-25 20:23:06 +0200
committercos <cos>2021-05-25 20:43:31 +0200
commit7639aea0aef14ce29d49e249a1af1da62733f609 (patch)
treeb68e2bee32400b48a6af735e14e8e76d653e159b
parent5d3e9f451b0ab29112111d64a0de8a44d1b59b2d (diff)
downloadcalendar-cli-7639aea0aef14ce29d49e249a1af1da62733f609.zip
Fix: Specify calendar rather than random selectionfix/require_calendar_url
Without this commit, the calendar that gets used is undefined. With at least some CalDAV implementation this practically means one is randomly selected at every run. Having determinism at the small cost of required configuration is the user expected behaviour for anyone using an account with more than one calendar.
-rwxr-xr-xcalendar-cli.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/calendar-cli.py b/calendar-cli.py
index ec9adaa..e9a36a5 100755
--- a/calendar-cli.py
+++ b/calendar-cli.py
@@ -148,6 +148,8 @@ def find_calendar(caldav_conn, args):
calendars = caldav.Principal(caldav_conn).calendars()
if not calendars:
sys.stderr.write("no calendar url given and no default calendar found - can't proceed. You will need to create a calendar first")
+ if len(calendars) > 1:
+ sys.stderr.write("no calendar url given and several calendars found - refusing to select one at random. You will need to specify which one to use")
return caldav.Principal(caldav_conn).calendars()[0]
def _calendar_addics(caldav_conn, ics, uid, args):