topydo icon indicating copy to clipboard operation
topydo copied to clipboard

filter expression with _or_

Open colinsullivan opened this issue 7 years ago • 5 comments

Hello,

Currently tasks must match all elements in a filter expression (separated by spaces):

As described here:

A filter expression consists of several terms separated by whitespace. A todo item must match each term in order to be selected/shown.

What if we could filter based on multiple expressions? Perhaps a comma could be used, like this:

topydo ls +MyProject,+MyOtherProject

This would list tasks from either project.

colinsullivan avatar Apr 03 '17 18:04 colinsullivan

We've discussed such feature with @bram85 some time ago. It needs major changes in how expressions are evaluated. Seems like we would need to write real tokenizer and parser for it to work properly and with backward compatibility. I believe this won't happen before 0.13.

mruwek avatar Apr 07 '17 16:04 mruwek

@colinsullivan Also syntax from your example won't play well with something more complex:

topydo ls +MyProject, +MyOtherProject +YetAnotherProject - how it should be evaluated?

Is it: +MyProject OR (+MyOtherPoject AND +YetAnotherProject) or maybe it should be: +MyProject OR +MyOtherProject AND +YetAnotherProject?

mruwek avatar Apr 07 '17 16:04 mruwek

My two-pennyworth - any parsing which assumes you understand the precedence of the operators is doomed to burn someone, sometime (me probably!). Some sort of parenthesis should be allowed even if not mandatory, from a usability perspective. As most of the time I suspect it will be used in config files for columns rather than for on-the-fly evaluations, it doesn't matter (to me anyway) if it is a bit clunky with quoted parentheses.

p-phillips avatar Apr 10 '17 21:04 p-phillips

Agreed, it's on my personal wish list too. As @mruwek explained, it should be done properly by parsing expressions including parentheses, while still maintaining backward compatibility with the current expressions.

bram85 avatar Apr 11 '17 10:04 bram85

Bump. Any progress on this feature? Still would be great to have. Thanks for a great tool!

TheCedarPrince avatar Jul 19 '21 21:07 TheCedarPrince