Repository navigation
fix(edit): guard --complete and --cancel on closed items like complete and cancel - #388
Merged
Merged
Conversation
…e and cancel edit --complete on an item already completed, or --cancel on one already cancelled, now leaves the status out of the write: with no other flags nothing is sent and the item is printed with a note, and with other flags those are sent and read back as usual. Completing a cancelled item, or cancelling a completed one, refuses the whole edit and sends nothing. Before, edit sent the status anyway, and Things switched a completed item to cancelled. The check is shared with complete and cancel.
--duplicate edits a copy Things makes with the item's status and leaves the item alone, so its status flag is sent as asked. Only completed and cancelled count as closed; any other status passes as before. The nothing-sent note is shared with complete and cancel, and applyEdit takes the target status runEdit works out instead of the two flags.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
things edit --completeand--cancelnow use the same already-closed check thatthings completeandthings cancelgot in #384. The check is shared, not copied.--completeon a completed item, or--cancelon a cancelled one: the status is left out of the write. If nothing else would change the item and there is no--reveal, nothing is sent: the item is printed with a note and the command exits 0. Otherwise the other flags are sent and read back as usual, so--complete --title xon a completed item still renames it.--cancelon a completed item, or--completeon a cancelled one: the whole edit is refused and nothing is sent, other flags included. This matchescomplete/cancel. Before this change, Things applied the switch: a completed item became cancelled.Checked in Things 3:
things:///updatewithcompleted=trueon a completed item changes nothing (same stop date, same modification date).canceled=trueon a completed item switches it to cancelled. A title change on a completed item applies and keeps the stop date.--duplicateof a cancelled item makes a cancelled copy.With
--duplicatethe guard is skipped and the status is sent as asked: the edit applies to the copy, and the item stays as it is, so--duplicate --cancelon a completed item gives a cancelled copy. Only completed and cancelled count as closed; any other raw status passes as before.project editshares the code path and gets the same behaviour. SKILL.md anddocs/content/commands.mdare updated.