From ebfa83c7f6d5c4aa248a9858a21186d128a4f6ab Mon Sep 17 00:00:00 2001 From: Gregory Klein Date: Tue, 12 May 2026 13:27:36 -0400 Subject: [PATCH 1/3] Add optional --calendar-name filter to calendar-events command --- fulcra_api/cli.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/fulcra_api/cli.py b/fulcra_api/cli.py index cb4e652..92ab6e7 100644 --- a/fulcra_api/cli.py +++ b/fulcra_api/cli.py @@ -203,15 +203,24 @@ def list_calendars(ctx): @cli.command("calendar-events", short_help="Return Apple calendar events") @time_range +@click.option( + "--calendar-name", type=str, default=None, help="Which calendar to retrieve events for by calendar name" +) @click.pass_context @requires_auth -def list_calendar_events(ctx, start_time: datetime, end_time: datetime): +def list_calendar_events(ctx, calendar_name: str | None, start_time: datetime, end_time: datetime): """Return Apple Calendar Event records across TIME_RANGE. TIME_RANGE: Two start & end date arguments in ISO8601 format or a single interval argument relative to the current time ("1 week", "2 days", "3h", etc.) """ + try: - results = ctx.obj.calendar_events(start_time, end_time) + calendar_ids_filter = None + if calendar_name is not None: + calendars = [c for c in ctx.obj.calendars() if c["calendar_name"].lower() == calendar_name.lower()] + calendar_ids_filter = [c["calendar_id"] for c in calendars] + + results = ctx.obj.calendar_events(start_time, end_time, calendar_ids=calendar_ids_filter) except HTTPError as exc: raise click.ClickException(exc) From bb8d94cdb26c4e5a3bd34bcddaef15f8d13b8cb0 Mon Sep 17 00:00:00 2001 From: Gregory Klein Date: Tue, 12 May 2026 13:32:36 -0400 Subject: [PATCH 2/3] Rename calendar_ids_filter to calendar_ids --- fulcra_api/cli.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fulcra_api/cli.py b/fulcra_api/cli.py index 92ab6e7..1f27905 100644 --- a/fulcra_api/cli.py +++ b/fulcra_api/cli.py @@ -215,12 +215,12 @@ def list_calendar_events(ctx, calendar_name: str | None, start_time: datetime, """ try: - calendar_ids_filter = None + calendar_ids = None if calendar_name is not None: calendars = [c for c in ctx.obj.calendars() if c["calendar_name"].lower() == calendar_name.lower()] - calendar_ids_filter = [c["calendar_id"] for c in calendars] + calendar_ids = [c["calendar_id"] for c in calendars] - results = ctx.obj.calendar_events(start_time, end_time, calendar_ids=calendar_ids_filter) + results = ctx.obj.calendar_events(start_time, end_time, calendar_ids=calendar_ids) except HTTPError as exc: raise click.ClickException(exc) From 00edd82cf4005abb0dfc4874d70f6d5797658522 Mon Sep 17 00:00:00 2001 From: Gregory Klein Date: Thu, 21 May 2026 16:56:33 -0400 Subject: [PATCH 3/3] Update --calendar-name help text --- fulcra_api/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fulcra_api/cli.py b/fulcra_api/cli.py index 1f27905..3391fc6 100644 --- a/fulcra_api/cli.py +++ b/fulcra_api/cli.py @@ -204,7 +204,7 @@ def list_calendars(ctx): @cli.command("calendar-events", short_help="Return Apple calendar events") @time_range @click.option( - "--calendar-name", type=str, default=None, help="Which calendar to retrieve events for by calendar name" + "--calendar-name", type=str, default=None, help="Return events matching calendar name." ) @click.pass_context @requires_auth