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.64k stars 188 forks source link

[feature request] Add tasks to a todo and add command for reindexing #316

Open amanger-qual opened 4 months ago

amanger-qual commented 4 months ago

I'm loving nb and how it's letting me store information in a whole new way! I generally use glow to view the files because the nb show command show the front matter metadata.

I stared using nb to track programming tasks and new notebooks that I need to create; however i found that I can't add a task to a todo without editing the todo file myself. Could a command be introduced to add tasks to todos after the fact? It would also be great if todos indexed separately from notebooks, but maybe it works just fine for everyone else :)

I'd also love to be able to reindex all the nb items. When an item is deleted or moved, I currently need to open up the .index file and manually reorder the lines to get the index value assignment to be sequential and in the order I desire. If there was a command like nb reindex or nb index -r, that would make this a lot easier!

Again, love this project! I'd love to help contribute if I knew more about this kind of development, but my skill set isn't quite there. Hopefully one day soon!

verajosemanuel commented 4 months ago

same here. Tried to add a TASK to an existing TODO but unable to find how. any hint?

holmescharles commented 3 months ago

I also crave being able to add a task to an existing todo. Right now I have to manually add it to a note via "edit". That's not so bad, but if a todo lacks any tasks at all, I also have to manually add the Tasks section. I wish this was handled for me.

xwmx commented 3 months ago

Glad you like nb!

nb index Subcommand

There is actually an nb index subcommand. It has a couple subcommands that might be useful here. nb index edit is currently only available with the latest development version:

nb index rebuild [--ancestors]
Rebuild the index, listing files by last modified, reversed. Some ids will change. Prefer nb index reconcile.
nb index reconcile [--ancestors] [--commit]
Remove duplicates and update index for added and deleted files.
nb index edit
Open the index file in `$EDITOR`.

Tasks

The nb tasks subcommand is currently limited to listing tasks and marking them done or undone. The logic for other task operations seems a little complicated, so I haven't tackled it yet. For example, tasks can show up anywhere in a document, and there can be multiple task lists in a single document. Tasks are indexed on the fly, so removing a task changes the index for all subsequent tasks in the document, which makes deleting multiple tasks more complicated.