macnotesapp
macnotesapp copied to clipboard
Add `notes view` command to a view a note
notes view NAME
prints note with NAME or closest match to terminal. Use mardownify and rich to convert HTML to rich markup for printing in terminal. (Add --plain or --no-markup mode for plaintext)
@RheTbull Are you accepting PR for this as I've been working on an intelligent project management tool for iOS data for a while and just found your repo today. If you are accepting PR I'm looking at this issue as my possible first PR but I was curious if this app was 100% in the terminal for a reason or if the markdown was just an aesthetic preference?
He @datatalking I'm certainly happy for PRs. macnotesapp has two components: 1) a python API for working with the Notes app and retrieving/creating notes and 2) a command line tool for working with Notes in the terminal. The second was my primary motivation for writing this as I spend a lot of time in the terminal and wanted to be able to access my notes from Notes.app. This feature is specifically to view a note (with formatting) in the terminal using the CLI. Using Markdown allows me to use the rich package to display rich formatting in the terminal (bold, italics, colors, etc.) If not using the terminal, then I would just use Notes.app to view the note. You could of course open a note in the Notes.app from the terminal if desired but if I'm already in the terminal, I'd want to stay there.
Note there is already a notes cat "note name"
feature so that might supersede the need for notes view
(or notes view
could open the note in Notes.app)
@RhetTbull So if I access Notes data with the code it will change what and how its currently written, so I would need to create and test examples.
I also experienced '#tagname' stripping so have been parsing those out with a preprocessing script I could you send a PR.
I have top level notes for a subject and two sub levels on some or on others a single stack of notes sometimes 5 layers deep. This makes me wonder if I can add 'kwarg' or some linux
into my notes that would tell macnotesapp to parse as a subject with two levels or a single stack of 5 layers?
The other initial PR idea I had was to connect an ability to parse the data to a database? It feels like this could be done from a few of these files, any file or line of code you would suggest to start from?
@datatalking
So if I access Notes data with the code it will change what and how its currently written, so I would need to create and test examples
Only if you modify the data in Notes. If you read the data it will not change any formatting.
I also experienced '#tagname' stripping so have been parsing those out with a preprocessing script I could you send a PR.
Sure, happy to take a look at any scripts you have that might help with this.
single stack of notes sometimes 5 layers deep.
I'm not sure what you mean by this. If you mean subfolders then macnotesapp cannot currently parse subfolders beyond the top-level. That's a limitation of the scripting interface to Notes though I believe it may be fixed on Ventura (would need to verify and update macnotesapp). I don't use subfolders (for anything...I decided a long time ago that top-level folders + search was far easier than trying to remember what sub-folder to put a thing in) so I'm not motivated to fix this at the moment.
If you mean parsing some info in the note to figure out which go together, that's certainly possible if you use a consistent naming scheme.
The other initial PR idea I had was to connect an ability to parse the data to a database?
See #23 (Add export command). This is definitely something I'd like to do and wouldn't be too hard. Create a schema, read the notes, and write them to the database. The dump command might be a good start as it dumps all data for all notes:
https://github.com/RhetTbull/macnotesapp/blob/40e442a6526225346716679bff1ad91eff017e32/macnotesapp/cli/cli.py#L327-L337
See also apple-notes-to-sqlite