xwmx / nb

CLI and local web plain text note‑taking, bookmarking, and archiving with linking, tagging, filtering, search, Git versioning & syncing, Pandoc conversion, + more, in a single portable script.
https://xwmx.github.io/nb
GNU Affero General Public License v3.0
6.6k stars 187 forks source link

Get all descendant todos? #184

Open jxpx777 opened 2 years ago

jxpx777 commented 2 years ago

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?

xwmx commented 2 years ago

@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.

jxpx777 commented 2 years ago

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 commented 2 years ago

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.

xwmx commented 2 years ago

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.

tomasohaodha commented 1 year ago

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.

ivishalgandhi commented 1 year ago

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.

xwmx commented 1 year ago

@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.

ivishalgandhi commented 1 year ago

@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

GrazingScientist commented 11 months ago

Dear @xwmx ,

will this feature also be available for all descending notes?

xwmx commented 11 months ago

@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.

GrazingScientist commented 11 months ago

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).

theutz commented 1 month ago

I'm having the same problem as @GrazingScientist running 7.12.1