Compare commits
1 Commits
a289664f10
...
2880076705
Author | SHA1 | Date |
---|---|---|
Ferdinand Thiessen | 2880076705 |
|
@ -1,4 +1,5 @@
|
|||
import click
|
||||
from importlib_metadata import entry_points
|
||||
|
||||
|
||||
@click.command()
|
||||
|
@ -8,14 +9,21 @@ import click
|
|||
@click.option("--no-core", help="Skip models / types from flaschengeist core", is_flag=True)
|
||||
def export(namespace, output, no_core, plugin):
|
||||
from flaschengeist import logger, models
|
||||
from flaschengeist.app import get_plugins
|
||||
from .InterfaceGenerator import InterfaceGenerator
|
||||
|
||||
gen = InterfaceGenerator(namespace, output, logger)
|
||||
if not no_core:
|
||||
gen.run(models)
|
||||
if plugin:
|
||||
for plugin_class in get_plugins():
|
||||
if (len(plugin) == 0 or plugin_class.id in plugin) and plugin_class.models is not None:
|
||||
gen.run(plugin_class.models)
|
||||
for entry_point in entry_points(group="flaschengeist.plugins"):
|
||||
if len(plugin) == 0 or entry_point.name in plugin:
|
||||
try:
|
||||
plugin = entry_point.load()
|
||||
gen.run(plugin.models)
|
||||
except:
|
||||
logger.error(
|
||||
f"Plugin {entry_point.name} could not be loaded due to an error.",
|
||||
exc_info=True,
|
||||
)
|
||||
continue
|
||||
gen.write()
|
||||
|
|
Loading…
Reference in New Issue