added subdomain to the "flask routes" command
This commit is contained in:
parent
daf6966c89
commit
0038ea3561
1 changed files with 4 additions and 4 deletions
|
|
@ -1018,20 +1018,20 @@ def routes_command(sort: str, all_methods: bool) -> None:
|
||||||
for rule in rules
|
for rule in rules
|
||||||
]
|
]
|
||||||
|
|
||||||
headers = ("Endpoint", "Methods", "Rule")
|
headers = ("Sub Domain","Endpoint", "Methods", "Rule")
|
||||||
widths = (
|
widths = (
|
||||||
|
max(len(rule.subdomain) for rule in rules),
|
||||||
max(len(rule.endpoint) for rule in rules),
|
max(len(rule.endpoint) for rule in rules),
|
||||||
max(len(methods) for methods in rule_methods),
|
max(len(methods) for methods in rule_methods),
|
||||||
max(len(rule.rule) for rule in rules),
|
max(len(rule.rule) for rule in rules),
|
||||||
)
|
)
|
||||||
widths = [max(len(h), w) for h, w in zip(headers, widths)]
|
widths = [max(len(h), w) for h, w in zip(headers, widths)]
|
||||||
row = "{{0:<{0}}} {{1:<{1}}} {{2:<{2}}}".format(*widths)
|
row = "{{0:<{0}}} {{1:<{1}}} {{2:<{2}}} {{3:<{3}}}".format(*widths)
|
||||||
|
|
||||||
click.echo(row.format(*headers).strip())
|
click.echo(row.format(*headers).strip())
|
||||||
click.echo(row.format(*("-" * width for width in widths)))
|
click.echo(row.format(*("-" * width for width in widths)))
|
||||||
|
|
||||||
for rule, methods in zip(rules, rule_methods):
|
for rule, methods in zip(rules, rule_methods):
|
||||||
click.echo(row.format(rule.endpoint, methods, rule.rule).rstrip())
|
click.echo(row.format(rule.subdomain, rule.endpoint, methods, rule.rule).rstrip())
|
||||||
|
|
||||||
|
|
||||||
cli = FlaskGroup(
|
cli = FlaskGroup(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue