[cli.routes:export] shows a header to describe the CSV, can be deactivated
This commit is contained in:
parent
f4880f1f9c
commit
ea8e7ede65
@ -14,8 +14,9 @@ from ..lib.domain import gen_router_routes
|
|||||||
|
|
||||||
@click.argument('module', required=True)
|
@click.argument('module', required=True)
|
||||||
@click.option('--export', default=False, is_flag=True)
|
@click.option('--export', default=False, is_flag=True)
|
||||||
|
@click.option('--noheader', default=False, is_flag=True)
|
||||||
@cli.command()
|
@cli.command()
|
||||||
def routes(module, export=False):
|
def routes(module, export=False, noheader=False):
|
||||||
"""
|
"""
|
||||||
The "halfapi routes" command
|
The "halfapi routes" command
|
||||||
"""
|
"""
|
||||||
@ -25,13 +26,15 @@ def routes(module, export=False):
|
|||||||
raise click.BadParameter('Cannot import this module', param=module) from exc
|
raise click.BadParameter('Cannot import this module', param=module) from exc
|
||||||
|
|
||||||
if export:
|
if export:
|
||||||
|
if not noheader:
|
||||||
|
click.echo(';'.join(('path', 'method', 'module:function', 'acl',
|
||||||
|
'in_parameters')))
|
||||||
for path, verb, m_router, fct, parameters in gen_router_routes(mod, []):
|
for path, verb, m_router, fct, parameters in gen_router_routes(mod, []):
|
||||||
for param in parameters:
|
for param in parameters:
|
||||||
click.echo(';'.join((
|
click.echo(';'.join((
|
||||||
path,
|
path,
|
||||||
verb,
|
verb,
|
||||||
m_router.__name__,
|
f'{m_router.__name__}:{fct.__name__}',
|
||||||
fct.__name__,
|
|
||||||
param['acl'].__name__,
|
param['acl'].__name__,
|
||||||
','.join((param.get('in', [])))
|
','.join((param.get('in', [])))
|
||||||
)))
|
)))
|
||||||
|
Loading…
Reference in New Issue
Block a user