Skip to content

Add the ability to edit or clear the due date, and priority. - #87

Open
bitfieldz wants to merge 2 commits into
keith:mainfrom
bitfieldz:edit_duedate_priority
Open

bitfieldz wants to merge 2 commits into
keith:mainfrom
bitfieldz:edit_duedate_priority

Conversation

@bitfieldz

Copy link
Copy Markdown
Contributor

No description provided.

@oschrenk

Copy link
Copy Markdown

That is a great feature. any chance of merging it?

udondan pushed a commit to udondan/reminders-cli that referenced this pull request Sep 13, 2026
Adapted from the priority portion of upstream pull request
keith/reminders-cli#87 by Aaron Fields; the due date portion of that
pull request is already covered by our existing --due-date and
--clear-due-date support. Reuses the existing Priority enum instead
of duplicating its raw value mapping.

Co-authored-by: Aaron Fields <spirotot@gmail.com>
@rameshbaskaran

Copy link
Copy Markdown
Contributor

Thanks for this PR. I built the PR head locally (Swift 6.4, macOS) and tested edit against a throwaway list.

Works as intended:

  • setting and clearing a due date by external ID (date-only and with a time)
  • priority changes when combined with another flag
  • combined edits; notes and other reminders are not clobbered; invalid input is rejected; repeated edits are fine

Two small defects:

  1. --priority or --clear-priority on its own is rejected by validate() with "Must specify new reminder content, new notes, or a new due date". Priority edits only work alongside another flag.
  2. --clear-due-date and --clear-priority both use .shortAndLong, so they both claim -c. -c alone clears only the due date.

A small patch that fixes both:

Patch (CLI.swift)
--- a/Sources/RemindersLibrary/CLI.swift
+++ b/Sources/RemindersLibrary/CLI.swift
@@ -236,7 +236,7 @@
     var dueDate: DateComponents?

     @Flag(
-        name: .shortAndLong,
+        name: .long,
         help: "Clear the due date.")
     var clearDueDate: Bool = false

@@ -246,7 +246,7 @@
     var priority: Priority?

     @Flag(
-        name: .shortAndLong,
+        name: .long,
         help: "Clear the priority of the reminder.")
     var clearPriority: Bool = false

@@ -266,7 +266,7 @@
             throw ValidationError("Don't try to set & clear the due date at the same time.")
         }

-        if self.reminder.isEmpty && self.notes == nil && self.dueDate == nil && !self.clearDueDate {
+        if self.reminder.isEmpty && self.notes == nil && self.dueDate == nil && !self.clearDueDate && self.priority == nil && !self.clearPriority {
             throw ValidationError("Must specify new reminder content, new notes, or a new due date.")
         }
     }

Editing due date and priority is the main thing missing for scripting, so it would be great to see this merged and a release cut. Happy to test further if useful.

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.

5 participants