doorstop icon indicating copy to clipboard operation
doorstop copied to clipboard

Plugin system?

Open jacebrowning opened this issue 5 years ago • 1 comments

In https://github.com/jacebrowning/doorstop/issues/375, I discussed the idea of a plugin system to call validation hooks automatically.

One way this could be implemented is to have Doorstop look for doorstop_hooks.py in the root of a project and pass callbacks into Tree.validate() automatically if functions matching a certain naming convention (e.g. "check_document" and "check_item") are defined.

What do others think?

jacebrowning avatar Jul 28 '19 00:07 jacebrowning

I would generalize this plugin system a bit. It should be possible to register custom commands via sub-parsers in main() in doorstop/cli/main.py. The problem is that we have to find the project root before the sub-parsers are registered. I would place the plugin configuration in the .doorstop.yml of the top level document, e.g.

plugins:
- path/to/plugin-0.py
- path/to/plugin-1.py

sebhub avatar Jul 28 '19 09:07 sebhub