Skip to content

Add --due-date and --clear-due-date to the edit command - #108

Open
rameshbaskaran wants to merge 1 commit into
keith:mainfrom
rameshbaskaran:edit-due-date
Open

Add --due-date and --clear-due-date to the edit command#108
rameshbaskaran wants to merge 1 commit into
keith:mainfrom
rameshbaskaran:edit-due-date

Conversation

@rameshbaskaran

Copy link
Copy Markdown
Contributor

reminders add supports -d/--due-date, but reminders edit had no way to change a reminder's due date - only its title and notes. Changing a due date meant deleting and re-adding the reminder.

This adds to edit:

  • -d/--due-date <date> - set a new due date, parsed by the same DateComponents natural-language parser add uses
  • --clear-due-date - remove the due date entirely

Behaviour details:

  • Setting a new due date clears existing alarms and adds an absolute alarm when the parsed date includes a time, mirroring add.
  • Clearing the due date also clears alarms, so a stale notification doesn't fire.
  • The two flags are mutually exclusive.
  • edit now accepts a due-date change on its own; previously validation required new text or notes.

Tested manually against a scratch list on macOS: setting a date, setting a date with a time, clearing, combining a date change with new text, and both validation errors.

$ reminders edit Soon 0 --due-date "tomorrow 9am"
Updated reminder 'Some edited text'
$ reminders edit Soon 0 --clear-due-date
Updated reminder 'Some edited text'

Branched off main and independent of #107 (--repeat); no overlapping changes.

The edit command could change a reminder's title and notes but had no way
to change its due date, even though add supports --due-date. This adds:

- edit --due-date/-d <date>: set a new due date, parsed with the same
  natural language parser add uses
- edit --clear-due-date: remove the due date entirely

Setting a new due date replaces any existing alarms, and adds an absolute
alarm when the parsed date includes a time, matching add's behaviour.
Clearing the due date also removes existing alarms.

--due-date and --clear-due-date are mutually exclusive, and edit now
accepts a due date change alone (previously it required new text or notes).
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.

1 participant