Repository navigation
fix(project): warn when project add --area names no area - #352
Merged
Merged
Conversation
Things creates the project with no area when --area matches none, and says nothing. It matches the title ignoring case but not surrounding space, which I checked with throwaway projects. project add now warns on stderr in that case, as add does for --list, and still sends the project.
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.
What was wrong
addwarns on stderr when--list/--project/--headingwon't land where you asked (#343).project add --areahad no such warning. When--areamatches no area, Things creates the project with no area and doesn't say so. I confirmed that with a throwaway project.What changed
project addnow checks--areaagainst the areas in the database before sending. If nothing matches, it prints this and still creates the project:A uuid of an area still goes to Things as
area-id(#344). The check follows what Things itself matches, which I tested with throwaway projects:personalmatches an area called Personal, so Things ignores case." Personal "with surrounding spaces does not match, so Things does not ignore surrounding space.I also tried
add --list " Personal "with a throwaway to-do. It went to the Inbox, so Things does not trim thelistparameter either.db.AddTarget(behindadd's warning) and theFoldTagcomment still assume Things trims, so a padded--listcurrently gets no warning. That's left for a separate change. A comment inprojectAreaIDrecords this.Because of that, the new check compares the real area titles without trimming instead of reusing
FindAreaUUID. That covers areas whose own titles have trailing spaces too.commands.md and SKILL.md describe the warning.
How it was tested
TestProjectAddWarnsOnUnknownAreacovers seven cases: title, other case, uuid, unknown name, padded input, padded stored title, and padded stored title with unpadded input. In every case the project is still sent once. The cases failed before the fix, and the two stored-title cases failed against my first, input-only version.make testandmake lintpass." Personal "printed the warning and got no area.personaland the area's uuid printed nothing and were filed under Personal. All throwaway items are in the Trash.