Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tasklib should respect context or support it as an option IMO #133

Open
5balls opened this issue Oct 4, 2024 · 1 comment
Open

tasklib should respect context or support it as an option IMO #133

5balls opened this issue Oct 4, 2024 · 1 comment

Comments

@5balls
Copy link

5balls commented Oct 4, 2024

I think context should be supported.

As a workaround I have code similar to this:

from tasklib import TaskWarrior

tw = TaskWarrior(data_location='~/.task')

context = tw.execute_command(["_get","rc.context"])[0]

if context:
  context_read = tw.execute_command(["_get","rc.context." + context + ".read"])[0]
  context_filter = '+PENDING and ( ' + context_read + ')'
  nexttasks = tw.tasks.filter(context_filter)
else:
  nexttasks = tw.tasks.pending()
@5balls
Copy link
Author

5balls commented Oct 4, 2024

As a side remark:

tw.tasks.pending().filter(context_filter)

would not work as it does not do an and operation but an or operation instead - not what I would expect.

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

No branches or pull requests

1 participant