Skip to content

fix(add): match --list and --heading titles untrimmed, as Things does - #359

Merged
ryanlewis merged 1 commit into
mainfrom
fix/list-target-untrimmed
Oct 3, 2026
Merged

ryanlewis merged 1 commit into
mainfrom
fix/list-target-untrimmed

Conversation

@ryanlewis

Copy link
Copy Markdown
Owner

What was wrong

add warns when --list/--project/--heading won't land where you asked (#343). The check (db.AddTarget) trimmed surrounding space before matching, on the assumption that Things does the same. It doesn't. I tested with throwaway items, sending things:///add URLs straight to the app:

  • list= Personal (an area, padded) went to the Inbox.
  • list= zz things-cli test E proj (a project, padded) went to the Inbox.
  • heading= Setup was dropped, and the to-do went to the project with no heading.
  • list=ZZ THINGS-CLI TEST E PROJ and heading=setup matched, so case is ignored.

So a padded --list or --heading got no warning and landed somewhere else.

Tags are different. tags= Ideas , tags=ideas and tags=Ideas, Calls all got the right tags, so Things trims tags and ignores their case. FoldTag was already right for them, but its comment claimed area names are trimmed too.

What changed

  • AddTarget compares project, area and heading titles with FoldCase and no trim, so a padded name now gets the warning. The add is still sent.
  • A uuid still matches with surrounding space trimmed. It goes to Things as list-id, which the CLI sends trimmed, so a padded uuid keeps working as it did before.
  • project add --area now trims a uuid the same way for area-id. Before this, a padded uuid fell through as an area title and got no area.
  • The FoldTag comment now says the trim is for tags only.
  • commands.md and SKILL.md say these names ignore case but not surrounding space.

FindAreaUUID stays: things open --area still uses it.

How it was tested

  • New cases in TestAddTarget: padded project, area and heading; a padded uuid; an area whose stored title has a trailing space. Also padded --list/--heading warning cases and padded-uuid list-id/area-id cases in the cmd tests. They failed before the change and pass now.
  • make test and make lint pass.
  • Built binary against the real app: add --list " Personal " warned and went to the Inbox. add --list personal gave no warning and was filed under Personal. All throwaway items are in the Trash.

Things ignores case in things:///add's list and heading, but not
surrounding space: throwaway to-dos with list=" Personal " and a padded
project name went to the Inbox, and a padded heading was dropped.
AddTarget trimmed them, so add gave no warning.

AddTarget now folds titles without trimming. A uuid still matches with
surrounding space trimmed, since it goes to Things as list-id and the CLI
sends that trimmed; project add --area now does the same for area-id.
Tags are trimmed by Things, so FoldTag stays for them; its comment no
longer claims area names are trimmed.
@ryanlewis
ryanlewis merged commit 6efea79 into main Oct 3, 2026
10 checks passed
@ryanlewis
ryanlewis deleted the fix/list-target-untrimmed branch October 3, 2026 23:08
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