Open adriangalilea opened 7 months ago
I can guarantee that taskwarrior-tui doesn't interpret context as taskwarrior does, for instance:
context.default.read="(project.not:side-quest and tags.not:side-quest)" or urgency>5
Will work on taskwarrior-tui but fail on taskwarrior, and:
context.default.read=(project.not:side-quest and tags.not:side-quest) or urgency>5
Will work on taskwarrior but fail on taskwarrior-tui.
So I can either use one or the other, not both.
When you say it fails in taskwarrior-tui
, does it error? Or does it just not display the correct tasks?
taskwarrior-tui
calls task export
as a subprocess (i.e. std::process::Command
) and reads the json.
You can look at the log files of taskwarrior-tui
to see the exact subprocess that is created and executed by taskwarrior-tui
:
Maybe that'll help narrow down what is going on?
I'm assuming it has something to do with how the context string is spliced into the subprocess when tasks are exported:
❯ export TASKWARRIOR_TUI_LOG_LEVEL=debug
❯ taskwarrior-tui
Does not show me any logs unless they are somewhere I'm unfamiliar with.
When you say it fails in taskwarrior-tui, does it error? Or does it just not display the correct tasks?
I'm having some inconsistencies, over iterations(slightly modified context) I had 3 different results:
context.default.read=(project.not:side-quest and tags.not:side-quest) or urgency>5
as context tests:task
output
taskwarrior-tui
output
context.default.read='(project.not:side-quest and tags.not:side-quest)' or urgency>5
as context tests:task
output
taskwarrior-tui
output
I've ran into the same problem.
diff /.snapshots/home-20240822_060000/user/.taskrc ~/.taskrc
46c46
< context.main.read=((tag:birthday and due.before:now+1month) or (-birthday)) and ((tag:holiday and due.before:now+1week) or (-holiday)) and project.not:ddd
---
> context.main.read=((tag:birthday and due.before:now+1month) or (-birthday)) and ((tag:holiday and due.before:now+1week) or (-holiday)) and (project.not:ddd and project.not:wfc)
This small change made taskwarrior show only 'Task not found". Using the context with task works. The log is
2024-08-22 08:42:47 | INFO | src/app.rs:1723 | Running `Command {
program: "task",
args: [
"task",
"rc.json.array=on",
"rc.confirmation=off",
"rc.json.depends.array=on",
"rc.color=off",
"rc._forcecolor=off",
"rc.report.next.filter=status:pending -WAITING",
"((tag:birthday",
"and",
"due.before:now+1month)",
"or",
"(-birthday))",
"and",
"((tag:holiday",
"and",
"due.before:now+1week)",
"or",
"(-holiday))",
"and",
"(project.not:ddd",
"and",
"project.not:wfc)",
"export",
"next",
],
create_pidfd: false,
}`
I don't know if it helps anything, but copying these for python's subprocess, the one given by taskwarrior-tui fails with Mismatched parentheses in expression
, but if I combine the context filter to one argument, it works:
>>> x=[
... "task",
... "rc.json.array=on",
... "rc.confirmation=off",
... "rc.json.depends.array=on",
... "rc.color=off",
... "rc._forcecolor=off",
... "rc.report.next.filter=status:pending -WAITING",
... "((tag:birthday",
... "and",
... "due.before:now+1month)",
... "or",
... "(-birthday))",
... "and",
... "((tag:holiday",
... "and",
... "due.before:now+1week)",
... "or",
... "(-holiday))",
... "and",
... "(project.not:ddd",
... "and",
... "project.not:wfc)",
... "export",
... "next",
... ]
>>> z=subprocess.run(x,capture_output=True)
>>> z
CompletedProcess(args=['task', 'rc.json.array=on', 'rc.confirmation=off', 'rc.json.depends.array=on', 'rc.color=off', 'rc._forcecolor=off', 'rc.report.next.filter=status:pending -WAITING', '((tag:birthday', 'and', 'due.before:now+1month)', 'or', '(-birthday))', 'and', '((tag:holiday', 'and', 'due.before:now+1week)', 'or', '(-holiday))', 'and', '(project.not:ddd', 'and', 'project.not:wfc)', 'export', 'next'], returncode=2, stdout=b'', stderr=b'Configuration override rc.json.array=on\nConfiguration override rc.confirmation=off\nConfiguration override rc.json.depends.array=on\nConfiguration override rc.color=off\nConfiguration override rc._forcecolor=off\nConfiguration override rc.report.next.filter=status:pending -WAITING\nMismatched parentheses in expression\n')
>>> x2=[
... "task",
... "rc.json.array=on",
... "rc.confirmation=off",
... "rc.json.depends.array=on",
... "rc.color=off",
... "rc._forcecolor=off",
... "rc.report.next.filter=status:pending -WAITING",
... "((tag:birthday " +
... "and " +
... "due.before:now+1month) " +
... "or " +
... "(-birthday)) " +
... "and " +
... "((tag:holiday " +
... "and " +
... "due.before:now+1week) " +
... "or " +
... "(-holiday)) " +
... "and " +
... "(project.not:ddd " +
... "and " +
... "project.not:wfc)",
... "export",
... "next",
... ]
>>> z2=subprocess.run(x2,capture_output=True)
>>> z2
CompletedProcess(args=['task', 'rc.json.array=on', 'rc.confirmation=off', 'rc.json.depends.array=on', 'rc.color=off', 'rc._forcecolor=off', 'rc.report.next.filter=status:pending -WAITING', '((tag:birthday and due.before:now+1month) or (-birthday)) and ((tag:holiday and due.before:now+1week) or (-holiday)) and (project.not:ddd and project.not:wfc)', 'export', 'next'], returncode=0, stdout=b'[\n{"id":43,"description":.......(all the tasks)
Had time to test it
//if let Some(args) = shlex::split(&self.current_context_filter) {
// for arg in args {
// task.arg(arg);
// }
//}
task.arg(self.current_context_filter.trim());
src/app.rs
, I changed that starting from line 1694 and it seems to work.
Reproduction
$ task
$ taskwarrior-tui
My context is
side-quest
could it be because of the "-"??