Conversation
|
Thanks for the PR, I like the concept. I'm tied up on other projects at the minute but will take a look as soon as I can. |
|
@dullage thanks! Any updates? |
clach04
left a comment
There was a problem hiding this comment.
lgtm - I've not tested this out but when I first saw this project this first thing I wondered was would this fit into my existing git backed notes directory.
A later change may need to deal with error reporting to the UI, so the user knows something happened. For example with git, if a conflict has taken place and need manual merging.
|
|
||
| Requirements: | ||
|
|
||
| - python3, node, npm, pipenv |
There was a problem hiding this comment.
👍 thanks for doc'ing this. I was thinking about experimenting with this so this will help!
| import re | ||
| import shutil | ||
| import time | ||
| import subprocess |
There was a problem hiding this comment.
Pedantic suggestion; recommend moving this to the line above to have pep-8 sorting. I know the existing code isn't strictly adhering to this. https://pypi.org/project/isort/ can help with this.
| * Light/dark themes. | ||
| * Multiple authentication options (none, read-only, username/password, 2FA). | ||
| * Restful API. | ||
| * Hook on create/update/delete. |
There was a problem hiding this comment.
Recommend a new section to provide a demo like you did in the PR.
Alternative suggestion for git, sample. 100% Untested :-) I used this technique in some of my (shell) scripts I removed the git add -A to also handle deletes and possible renames (rename detection can be a little hit and miss)
FLATNOTES_HOOK_CREATE="git add -u :/ ; git add . && git commit -m 'note %s' && git push"
FLATNOTES_HOOK_UPDATE="$FLATNOTES_HOOK_CREATE"
FLATNOTES_HOOK_DELETE="$FLATNOTES_HOOK_CREATE"
|
|
||
| 1. Install deps: | ||
|
|
||
| pipenv install |
There was a problem hiding this comment.
Possibly dumb question; Should this include --ignore-pipfile?
Line 50 in 5b5369b
From https://pipenv.pypa.io/en/latest/commands.html#install
--ignore-pipfile — Install from the Pipfile.lock and completely ignore Pipfile information.
|
Sorry for the late reply. I have a few concerns with the current approach but hopefully a potential solution for them.
To solve these, my suggestion is to look into the [Background Tasks)(https://fastapi.tiangolo.com/tutorial/background-tasks/) functionality of FastAPI. You may be able to use this to perform the shell hook after the response has been returned to the client. Additionally, I think it would also be prudent to wrap the |
I completely understand and share your concerns. I apologize for not detailing these points in the PR description earlier. Given the specific use-case example, I couldn't identify a better alternative 🤷♂️ |
Adds shell hooks via environment variables
FLATNOTES_HOOK_<name>.FLATNOTES_HOOK_CREATE- executes once note createdFLATNOTES_HOOK_UPDATE- executes once note updatedFLATNOTES_HOOK_DELETE- executes once note removedIn each option,
%swill be replaced by path to note. Work dir is set to notes dir.It opens opportunity to enable syncs. For example: