things-cli anytime lists projects as well as tasks
Closed this issue · 9 comments
@AlexanderWillner said this issue I first reported in thingsapi/things-cli#11 would be better discussed here, so here it it:
To Reproduce
Steps to reproduce the behavior:
things-cli anytime
lists both tasks and projects.
Expected behavior
A list of only the tasks that show up under "Anytime" in Things, not the projects.
Additional context
Compare with:
things-cli today
which lists only tasks.
@cjchapman I stil have an older Things, so the behavior may have changed.
In my version, I can mark entire projects to be "Today" or "Anytime", and they'll show up in Today or Anytime; both within the Things app itself, and also for the things.py library.
Technically speaking, if you check the README.md of this library and the SQlite database, then a task is one of three types:
- 'to-do': can have checklists;
- 'project': can have to-dos and headings;
- 'heading': part of a project; groups to-dos.
they all support the start field, which can be set to 'Inbox', 'Anytime', or 'Someday'.
If you do want to see just to-dos and not projects or headings, then you can use the command:
>>> import things
>>> things.anytime(type="to-do")
and
>>> things.today(type="to-do")
(/cc @AlexanderWillner to confirm if this behavior is the same in the newer Things)
Compare with:
things-cli today
which lists only tasks
I'd say by default both methods return projects as well:
% things-cli today|grep "Project in Today"
- Project in Today (2023-05-24 | Anytime)
% python3 -c 'import things, json; print (json.dumps(things.today()))'|jq '.[].title'|grep "Project in Today"
"Project in Today"
% python3 -c 'import things, json; print (json.dumps(things.anytime()))'|jq '.[].title'|grep "Project in Today"
"Project in Today"
% things-cli anytime|grep "Project in Today"
- Project in Today (2023-05-24 | Anytime)
So at least it is coherent. Both could be filtered on the things-cli
side if this is requested. Via API:
% python3 -c 'import things, json; print (json.dumps(things.today(type="to-do")))'|jq '.[].title'|grep "Project in Today"
% python3 -c 'import things, json; print (json.dumps(things.anytime(type="to-do")))'|jq '.[].title'|grep "Project in Today"
%
To clarify:
When I do things-cli anytime
I see the names of the projects themselves as individual line items.
When I do things-cli today
I do not.
Thank you for clarifying, @cjchapman. I now understand.
Here is an example.
Assume we have a project P which has to-dos A, B, and C. We mark A as "today", but not P, B, or C.
Behavior in things-cli
Running things-cli today
will only return A.
Running things-cli anytime
will return P, A, B, and C… possibly in a random order.
Behavior in Things
Clicking on Today will only show A.
Clicking on Anytime will show P as a heading and A, B, and C as subitems.
@cjchapman : does the example correctly reflect your concern?
Yes, I am surprised by the inclusion of P in the output of things-cli anytime
in your example, as I only expected A, B, and C.
@cjchapman My hunch is that this can easiest be addressed by the https://github.com/thingsapi/things-cli library itself, by ordering the to-dos differently, and grouping under the project heading to mimic the Things app. (/cc @AlexanderWillner)
to mimic the Things app.
I think I see the confusion. In Things P
shows up as a heading in Anytime and things-cli
(probably our lib as well?) returns P
as a project in Anytime.
In case P
would be marked as "today", it shows up as a project in Today in Things and I think not anymore in Anytime, right?
So...I've not a strong opinion here - just filtering out projects in things-cli anytime
would be sufficient?
In case
P
would be marked as "today", it shows up as a project in Today in Things and I think not anymore in Anytime, right?
Today implies Anytime. The property start is one of: 'Inbox' (not sorted yet), 'Someday' (future opportunity), or 'Anytime' (I've committed to doing this... either on a fixed date, today, or no date).
So...I've not a strong opinion here - just filtering out projects in
things-cli anytime
would be sufficient?
Not filtering out, rather you might consider grouping to-dos and projects together like Things.app does it.
@cjchapman @AlexanderWillner Closing this, as it relates to things-cli
.