nb icon indicating copy to clipboard operation
nb copied to clipboard

Get all descendant todos?

Open jxpx777 opened this issue 1 year ago • 11 comments

I am experimenting with my notebooks' structures, seeing what works best for my needs. Right now, I have a small number of notebooks, one of which is "work". Within "work" I have a couple of different folders, one for my current client, one for initiatives I'm involved in within the consultancy, etc.

I like being able to list todos for a given folder such as nb todos clientname/, to see all todos related to my client. But when I run nb todos open from the top level of my notebook, I want to see all todos, regardless of their location within the notebook. Likewise, if I have a nesting structure of folders such as clientname/feature1/foo.todo.md, clientname/feature2/bar.todo.md for capturing notes and todos related to features I work on, I would like to see all notes for all those subfolders if I nb todos open clientname/.

Is this possible and just outside my understanding? If not, is it something that is planned for the future?

jxpx777 avatar Aug 08 '22 23:08 jxpx777

@jxpx777 There's a partially implemented --recursive / --tree option for todos (and list) that does this. It doesn't work with --limit and --page yet, but should work otherwise.

xwmx avatar Aug 08 '22 23:08 xwmx

Ah, --tree is exactly what I want—thanks!

I would humbly suggest that --tree should be the default behavior for nb todos with no arguments or when specifying a directory path. Since there are folder paths, tags, and general searching the user can use to limit by and because the notion that the result set will be filtered is implied by providing the filters themselves, I don't think there's any loss of functionality but clarity is greatly improved for the less explicit case.

jxpx777 avatar Aug 10 '22 01:08 jxpx777

Been playing with nb a little more and looks like the behavior is somewhat inconsistent. When I get items matching a tag, I don't have to specify that I want items in subfolders. Just adding this as another data point in favor of making tree behavior the default based on existing patterns in the app.

jxpx777 avatar Aug 15 '22 18:08 jxpx777

Yeah, todos is based on list / ls, which is scoped to the folder, while tag searching uses search, which is recursive. I like the idea of having todos use the --recursive / --tree behavior. I still need to finish implementing the option on list.

xwmx avatar Aug 16 '22 18:08 xwmx

Upvote on the recursive todos function. It would allow you to keep the todos with their relevant notes, while at the same time giving a universal view of all outstanding todos.

tomasohaodha avatar Oct 18 '22 16:10 tomasohaodha

Just curious if the feature to list all the tasks(folder/sub folder) is present, I am trying to get a list of all the open tasks in notebook without specifying the folder name. thank you.

ivishalgandhi avatar May 29 '23 14:05 ivishalgandhi

@ivishalgandhi As of the latest version 7.5.2, you should be able to list all tasks in a notebook with nb tasks example-notebook: --recursive or nb tasks example-notebook: --tree.

xwmx avatar Jun 11 '23 21:06 xwmx

@ivishalgandhi As of the latest version 7.5.2, you should be able to list all tasks in a notebook with nb tasks example-notebook: --recursive or nb tasks example-notebook: --tree.

Thank you @xwmx Looks great

ivishalgandhi avatar Jun 12 '23 00:06 ivishalgandhi

Dear @xwmx ,

will this feature also be available for all descending notes?

GrazingScientist avatar Oct 13 '23 10:10 GrazingScientist

@GrazingScientist Currently it is. Just run the command without tasks:

# list all items in the current notebook recursively
nb --recursive

# list all items in the current notebook recursively, alternative
nb --tree

# list all items in the 'example' notebook recursively
nb example: --recursive

Currently there are still some limitations with this feature, such as not working with filtering, which is why I've omitted it from the documentation so far.

xwmx avatar Oct 13 '23 23:10 xwmx

Thanks @xwmx for the hint. However, when using nb --tree or nb --recursive, I only get the same list as if using nb list. I am using nb 7.7.0 on Mac (installed via homebrew).

GrazingScientist avatar Oct 16 '23 06:10 GrazingScientist