Skip to content

Bring in list IDs and delete-completed-item support from upstream - #7

Merged
udondan merged 9 commits into
mainfrom
feat-upstream-list-ids-delete
Sep 13, 2026
Merged

udondan merged 9 commits into
mainfrom
feat-upstream-list-ids-delete

Conversation

@udondan

@udondan udondan commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Summary

Brings in two related upstream features from keith/reminders-cli, cherry-picked
from PR keith#90 (cromulus) and PR keith#103 (wrobel) to preserve original authorship,
adapted to this fork's current codebase:

  • show-lists now prints each list's calendarIdentifier alongside its title
    (name (id) in plain mode, calendarIdentifier/title fields in JSON), and
    every command that takes a list argument (show, show-all, add,
    complete, uncomplete, edit, delete) now accepts a list ID in addition
    to a name.
  • complete, uncomplete, and edit gained --format json, printing the
    affected reminder as JSON.
  • EKReminder JSON output now includes listId.

This fork had already independently fixed "can't delete a completed reminder"
(keith#106) with a simpler approach than upstream's --id/--index flag redesign
(auto-detecting whether the delete argument is a numeric index or an external
ID). That existing fix is kept as-is — the two upstream commits whose sole
purpose was the flag redesign (45e653f, cce8f74) are cherry-picked as empty
commits to credit wrobel for identifying and fixing the same underlying issue,
without changing delete's behavior.

Also fixed along the way (both were pre-existing bugs in the upstream diffs
themselves, not intentionally carried over):

  • Dropped a leftover, unused, duplicate add(...) method in Reminders.swift.
  • Dropped a stray debug print(reminders.map { $0.title! }) in setComplete.

Test plan

  • swift build -Xswiftc -warnings-as-errors
  • swift test -Xswiftc -warnings-as-errors — 79 tests pass, including a new
    IdentifierTests.swift covering list/reminder ID resolution and
    calendarIdentifier/listId JSON encoding
  • Manual smoke test via swift run reminders: show-lists plain/JSON,
    add/show/complete/edit by both list name and list ID, and
    delete by external ID on an already-completed item

cromulus and others added 9 commits September 13, 2026 15:15
Adds calendarIdentifier alongside each list's title in 'show-lists' output (both plain and JSON), so lists can be referenced by a stable ID.

Cherry-picked from keith#90, commit a494143 ("now we are outputting unique ids for lists").
Adds listId (the reminder's list's calendarIdentifier) to the JSON encoding of each reminder.

Cherry-picked from keith#90, commit 2b0cc0b ("showing list id in show-all").
addReminder's list argument now resolves either a list name or its calendarIdentifier.

Cherry-picked from keith#90, commit 1f7ac31 ("can create reminders using uuids").
…te/edit

setComplete and edit now resolve their reminder argument by numeric index or by calendarItemExternalIdentifier, and gain --format to print the updated reminder as JSON. Also removes a leftover debug print left in setComplete.

Cherry-picked from keith#90, commit db382c9 ("now can complete with IDs").
Renames the remaining listName/index arguments to listNameOrId/indexOrId across Show, Add, Edit and Delete, dropping an unused duplicate add() method left over from an earlier merge.

No changes on top of this branch: the renames were already applied while resolving conflicts on the preceding cherry-picks, including preserving this fork's own existing fix for deleting completed reminders by external id, and the delete command's list argument now resolves by name or id via the same calendar(withNameOrId:) helper.

Cherry-picked from keith#90, commit 9c05a67 ("adding ids to lists").
Upstream, this commit rebases cromulus' list-id work onto a newer base of reminders-cli so it applies again. In this fork the equivalent state was already reached while adapting the earlier commits in this series, so there is nothing further to apply here; kept as an empty commit to credit the rebase.

Cherry-picked from keith#103, commit 45e653f ("updated patch: making the UUID a first-class citizen").
Upstream, this commit adds --id/--index flags to delete so a completed reminder can be deleted by its external identifier. This fork already fixed the same underlying problem independently, with a smaller change that keeps the delete command's existing positional index-or-id argument and auto-detects whether it is numeric (index, scoped to incomplete items like show) or an external id (scoped to all items, completed included). That existing fix is kept as-is; this commit intentionally applies no changes and is kept empty to credit the upstream fix for the same issue.

Cherry-picked from keith/reminders-cli pull request 103 ("Allow to delete completed items").
Extract the list-name-or-id matching logic out of Reminders.calendar(withNameOrId:)
into a free function, and expose getReminder(from:atIndexOrId:) internally, so both
can be exercised directly via @testable import without needing live access to
Reminders.app, following the precedent already set by matchesAdditionalFilters.

Add IdentifierTests.swift covering: EKCalendar/EKReminder JSON encoding of
calendarIdentifier/listId, list resolution by id/title with id taking precedence on
a collision, and reminder resolution by index vs. external id, including not-found
cases.
Show that show-lists now prints each list's calendarIdentifier alongside its
title, that any list name argument also accepts an id, that complete/uncomplete/
edit support --format json, and how to delete an already-completed reminder by
its id.
@udondan
udondan merged commit 7ca8925 into main Sep 13, 2026
1 check passed
@udondan
udondan deleted the feat-upstream-list-ids-delete branch September 13, 2026 13:26
udondan added a commit that referenced this pull request Sep 13, 2026
…am (#7)

* feat: output unique list identifiers via show-lists

Adds calendarIdentifier alongside each list's title in 'show-lists' output (both plain and JSON), so lists can be referenced by a stable ID.

Cherry-picked from keith#90, commit 1778d75c ("now we are outputting unique ids for lists").

* feat: include list id in show-all JSON output

Adds listId (the reminder's list's calendarIdentifier) to the JSON encoding of each reminder.

Cherry-picked from keith#90, commit e1354ad6 ("showing list id in show-all").

* feat: accept a list id in place of a list name for add

addReminder's list argument now resolves either a list name or its calendarIdentifier.

Cherry-picked from keith#90, commit cf72df2b ("can create reminders using uuids").

* feat: accept a reminder id in place of an index for complete/uncomplete/edit

setComplete and edit now resolve their reminder argument by numeric index or by calendarItemExternalIdentifier, and gain --format to print the updated reminder as JSON. Also removes a leftover debug print left in setComplete.

Cherry-picked from keith#90, commit 2a87ecff ("now can complete with IDs").

* feat: finish threading list ids through show/add/edit/delete

Renames the remaining listName/index arguments to listNameOrId/indexOrId across Show, Add, Edit and Delete, dropping an unused duplicate add() method left over from an earlier merge.

No changes on top of this branch: the renames were already applied while resolving conflicts on the preceding cherry-picks, including preserving this fork's own existing fix for deleting completed reminders by external id, and the delete command's list argument now resolves by name or id via the same calendar(withNameOrId:) helper.

Cherry-picked from keith#90, commit 806e773d ("adding ids to lists").

* chore: rebase the list-id patch (no changes needed in this fork)

Upstream, this commit rebases cromulus' list-id work onto a newer base of reminders-cli so it applies again. In this fork the equivalent state was already reached while adapting the earlier commits in this series, so there is nothing further to apply here; kept as an empty commit to credit the rebase.

Cherry-picked from keith#103, commit 4c8bbb1f ("updated patch: making the UUID a first-class citizen").

* chore: acknowledge the upstream fix for deleting completed items

Upstream, this commit adds --id/--index flags to delete so a completed reminder can be deleted by its external identifier. This fork already fixed the same underlying problem independently, with a smaller change that keeps the delete command's existing positional index-or-id argument and auto-detects whether it is numeric (index, scoped to incomplete items like show) or an external id (scoped to all items, completed included). That existing fix is kept as-is; this commit intentionally applies no changes and is kept empty to credit the upstream fix for the same issue.

Cherry-picked from keith/reminders-cli pull request 103 ("Allow to delete completed items").

* test: cover list/reminder id resolution and list id encoding

Extract the list-name-or-id matching logic out of Reminders.calendar(withNameOrId:)
into a free function, and expose getReminder(from:atIndexOrId:) internally, so both
can be exercised directly via @testable import without needing live access to
Reminders.app, following the precedent already set by matchesAdditionalFilters.

Add IdentifierTests.swift covering: EKCalendar/EKReminder JSON encoding of
calendarIdentifier/listId, list resolution by id/title with id taking precedence on
a collision, and reminder resolution by index vs. external id, including not-found
cases.

* docs: document list ids and per-command json format flags

Show that show-lists now prints each list's calendarIdentifier alongside its
title, that any list name argument also accepts an id, that complete/uncomplete/
edit support --format json, and how to delete an already-completed reminder by
its id.

---------

Co-authored-by: Bill Cromie <bill.cromie@gmail.com>
Co-authored-by: Gunnar Wrobel <post@gunnarwrobel.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants