VladimirMarkelov / ttdl

TTDL - Terminal Todo List Manager
MIT License
209 stars 17 forks source link

Support more filter options for threshold #40

Closed samuelallan72 closed 3 years ago

samuelallan72 commented 3 years ago

I want to filter to display only tasks with no threshold date, or a threshold date <= today. The standard filter options support this with the none..today range, but this isn't implemented for thresholds:

❯ ttdl list --due none..today
# D P Created    Finished   Due        Subject
...

❯ ttdl list --threshold none..today
invalid value none..today for date range

Is there a design reason why thresholds should be treated differently to other date fields for filtering? Otherwise can we update the behaviour to be consistent with the others? (If so, I'm happy to open a PR)

VladimirMarkelov commented 3 years ago

It is hard to tell the truth as I do not remember why it was done this way :) Maybe, because threshold was not included to original Todo-txt format description, and its usage was a bit vague to me.

Anyway, I agree that threshold should follow the same rules. I changed the code(it got even smaller). In addition, I have upgraded used libraries and fixed a few clippy warnings. It seems working, and you can try running new code. If anything looks good, I'll add a new tag and build binaries for the new version early next week.

samuelallan72 commented 3 years ago

Thanks @VladimirMarkelov! For this to work completely, you'll also need to update filter_threshold in todo_lib to support the same range logic as filter_due and filter_created.

By the way, I just discovered this software today as I was researching tools to use with the todo.txt format, and I really like it so far. :+1: If I come across minor bugs and typos, are you ok with me opening pull requests?

VladimirMarkelov commented 3 years ago

Aha, I see that threshold processing function misses Higher branch. Thank you for pointing at it! And as a second thought, maybe those date processing function can be simplified (extract common stuff to a separate function).

are you ok with me opening pull requests?

PRs are welcome :)

By the way, I just discovered this software today as I was researching tools to use with the todo.txt format, and I really like it so far.

Thank you! I created it for my own usage, and I am glad to hear that there are people who like and use it as well ;)

VladimirMarkelov commented 3 years ago

todo_lib updated and refactored.

And I found option conflict that made --completed failing with invalid date range always. Long version of conflicting option -A now is --only-completed

samuelallan72 commented 3 years ago

Thanks, this works perfectly now!