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

Filter todos/tasks by tags #294

Open
murchandamus opened this issue Dec 28, 2023 · 4 comments
Open

Filter todos/tasks by tags #294

murchandamus opened this issue Dec 28, 2023 · 4 comments

Comments

@murchandamus
Copy link

murchandamus commented Dec 28, 2023

Hey, thanks for your work on this great tool!
I’ve been using nb for a while for my notes and after recently setting myself up with a terminal emulator on my phone, have also been making more use of the todo and task feature.
I have been considering to move all todos to nb, but noticed that it doesn't currently seem possible to filter tasks with tags, i.e. to provide tags to filter the result of nb t and nb t open.

Currently (I created this example with 7.7.1, but looking over the list of commits since that release, I think this should describe the current situation):

➜  ~ nb t a "test" --tags work
Added: [175] ✔️  20231228151232.todo.md "[ ] test"
➜  ~ nb \#work
[175] ✔️  [ ] test
➜  ~ nb t open
[175] ✔️  [ ] test
…a dozen more open todos…
➜  ~ nb todos \#work
! No todos found.
➜  ~ nb t \#work  
[175] ✔️  [ ] test
…two dozen open and closed todos…
➜  ~ nb t open \#work
[175] ✔️  [ ] test
…a dozen more open todos…

So, creating a todo with the tag #work filters only this todo from the entire list of items, but the ways I tried to use a tag in combination with calling todos up, always either brings up all todos or none.

And it would be really cool, if instead:

➜  ~ nb t \#work  
[175] ✔️  [ ] test

only produced the todos that were tagged accordingly!

@xwmx
Copy link
Owner

xwmx commented Jan 3, 2024

@murchandamus Thanks for thinking this through. I agree. The tag filtering in ls currently delegates to search --tag while todos and tasks use list, so that functionality will need to be added to list so it's available here. I'll try to look into that soon.

@murchandamus
Copy link
Author

Awesome! Thanks for the explanation and receptive response

xwmx added a commit that referenced this issue Feb 7, 2024
xwmx added a commit that referenced this issue Feb 8, 2024
@xwmx
Copy link
Owner

xwmx commented Feb 8, 2024

@murchandamus As of version 7.11.0, todos can be filtered by tag using either nb todos \#example-tag or nb todos --tags example-tag. With tasks, all tasks within items matching the tag are displayed, not just the tasks containing the tag. I'm going to experiement and might change that to only displaying matching tagged tasks in a later iteration.

@murchandamus
Copy link
Author

Super, thank you! I only see this now, so I haven’t played around with it yet, but it would seem to me that the behavior with tags would work well for my purposes.

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

2 participants