[POC] Use default editor to edit a note#44
Conversation
|
There is a bug when I want to edit a note with checkboxes: Traceback (most recent call last):
File "/usr/bin/gkeep", line 33, in <module>
sys.exit(load_entry_point('gkeep==1.0.0', 'console_scripts', 'gkeep')())
File "/home/corentin/.local/lib/python3.9/site-packages/click/core.py", line 1137, in __call__
return self.main(*args, **kwargs)
File "/home/corentin/.local/lib/python3.9/site-packages/click/core.py", line 1062, in main
rv = self.invoke(ctx)
File "/home/corentin/.local/lib/python3.9/site-packages/click/core.py", line 1668, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/corentin/.local/lib/python3.9/site-packages/click/core.py", line 1668, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/corentin/.local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/corentin/.local/lib/python3.9/site-packages/click/core.py", line 763, in invoke
return __callback(*args, **kwargs)
File "/home/corentin/.local/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/lib/python3.9/site-packages/gkeep-1.0.0-py3.9.egg/google_keep_tasks/notes.py", line 244, in edit_note
setattr(note, param, value)
AttributeError: can't set attributeI will try to fix this later. |
e086430 to
06f4764
Compare
cfbe274 to
2f7a7a9
Compare
|
It does work now. The only thing not supported is reordering existing items because it was a bit harder to keep track of. Honestly, it was feasible but I lost the desire to use this CLI because of the slowness of the requests (the fault of a the unofficial API) and especially because Google always disconnects me on my phone because of the amount of requests I'm making while debugging. Anyway. This is just a POC, maybe it could be added in the CLI or in the API. Basically, when a note contains checkboxes, the following content is opened in your default editor: I used Markdown checkboxes because it's easier to edit manually than the Unicode checkboxes. The item IDs are needed to be able to keep track of the changes on each item, so that the changes can be done programmatically on each edited item. |
I wanted to be able to edit the existing content of my note in Vim.
Usage:
It uses
click.edit()so no library added. The only thing is that to get the optional value feature for Click options (implemented in pallets/click#1618) I needed to upgrade the version of click.So I added this in the requirements.
Note:
The function
click.edit()detects the editor, and it uses the environment variableEDITOR.So you can add
export EDITOR=vimin your~/.bashrc.