alanvardy / tod

An unofficial Todoist command line client written in Rust
MIT License
104 stars 9 forks source link

Task project not listed when not present #749

Closed stacksjb closed 6 months ago

stacksjb commented 6 months ago

If I am using a filter (such as tod list process -f '@Morning')

And the task is not in the local config, instead of listing the project, it will say "# Project not in config"

Ideally, the project name should still be listed for context - is this because the lookup of project ID to name is happening locally, and the result doesn't exist?

alanvardy commented 6 months ago

That's right, currently the lookup is local only so it is only checking the config file for a project with a matching ID.

I could look into doing an async API call to get a list of projects

stacksjb commented 6 months ago

Gotcha. It makes sense then.

As a dev I'm OK with just printing the error. OTOH, as an end user, I don't quite get the concept of managing projects separately and would expect this to just pull in all of my existing projects from Todoist

I could also see some sort of function where you perform a sync if a project ID isn't present - maybe as an async API call, or done on a timer or interval, or you could be prompted to perform an update if it's not in sync).

Going to have to think on this more. Maybe having a cached copy of local projects that is updated if it is out of sync or a project ID is missing might be good, though that might be duplicating what you have in the config.

I think closing this once the auto project import exists might be ok - especially if there is some sort of default import of all projects.

alanvardy commented 6 months ago

Oh that is an interesting idea. What if I have a configuration option to choose one of:

^ I could occasionally run this check async

I'm one of the people who likes to only have a subset of my projects available locally, but if someones workflow involves creating and deleting a lot I could see this being very useful.

Thoughts?

alanvardy commented 6 months ago

For now I will give instuctions to use tod project import --auto when this error occurs.

alanvardy commented 6 months ago

I think closing this once the auto project import exists might be ok - especially if there is some sort of default import of all projects.

Sounds good, we can open another issue later if need be. For now the resolution of the problem should be quick and easy.

stacksjb commented 6 months ago

Not to overbeat this, but now if I print out several tasks, it prints out once per task image

How difficult would it be to continue to print "project not found" and then print the line once at the end (basically as an error/notice) instead of on each task?

alanvardy commented 6 months ago

Haha, I'll figure out a way to put it only once into the error channel.

https://github.com/alanvardy/tod/issues/763