Source code for zemfrog.commands.api

import click
from flask.cli import with_appcontext

from ..generator import g_api, g_api_crud


@click.group("api")
[docs]def group():
""" API generator. """ @group.command() @with_appcontext @click.argument("name") @click.option("--crud", is_flag=True, help="Create a REST API based on the ORM model.")
[docs]def new(name, crud): """ Create REST API. """ func = g_api if crud: func = g_api_crud func(name)
[docs]command = group