bbeng89 / ntbk

A simple, opinionated terminal notebook inspired by bullet journaling.
MIT License
1 stars 0 forks source link

Handle subdirectories in collections #44

Closed bbeng89 closed 2 years ago

bbeng89 commented 2 years ago

I tested subdirectories with collections and it does actually work. For example:

foo@bar~:$ ntbk collection books/2022 1984

Does create a 2022 subdirectory in the books directory. So it creates and opens: collections/books/2022/1984.md

A few things are counter-intuitive though.

If i do ntbk collection books --list it doesnt return anything because it's only looking for .md files.

Also if i do ntbk collections it shows the file count of each but not folders. I'm sure I'll find other things as I keep testing.

Tasks

Originally posted by @bbeng89 in https://github.com/bbeng89/ntbk/issues/36#issuecomment-999049504

bbeng89 commented 2 years ago

More thoughts on this...

First, --list should have a shortcut -l.

Second, the default with subdirs should just list the folder names, but we should add another flag to list everything.

Say I have the following inside my books collection:

2021/1984.md
2021/dune.md
2022/wheel-of-time.md
2022/harry-potter.md
goals.md
index.md

I think just doing ntbk c books --list would return:

2021/
2022/
goals.md
index.md

Keeping the slash at the end could indicate it's a dir. Or dirs could be a different color. (or both).

But then to list everything there could be another flag. I'm thinking either --all/-a or --recursive/-r

So doing ntbk c books -la would return:

2021/1984.md
2021/dune.md
2022/wheel-of-time.md
2022/harry-potter.md
goals.md
index.md

And it would recursively go through all subdirectories.