22 lines
948 B
Python
22 lines
948 B
Python
|
import click
|
||
|
|
||
|
|
||
|
@click.command()
|
||
|
@click.option("--output", "-o", help="Output file, default is stdout", type=click.Path())
|
||
|
@click.option("--namespace", "-n", help="TS namespace for the interfaces", type=str, show_default=True)
|
||
|
@click.option("--plugin", "-p", help="Also export types for a plugin (even if disabled)", multiple=True, type=str)
|
||
|
@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)
|
||
|
gen.write()
|