From 0038ea35610b21122813570b6bf517fe62011123 Mon Sep 17 00:00:00 2001 From: "5.413U14M4N" Date: Fri, 7 Apr 2023 18:01:16 +0530 Subject: [PATCH] added subdomain to the "flask routes" command --- src/flask/cli.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/flask/cli.py b/src/flask/cli.py index 37a15ff2..a63f14e9 100644 --- a/src/flask/cli.py +++ b/src/flask/cli.py @@ -1018,20 +1018,20 @@ def routes_command(sort: str, all_methods: bool) -> None: for rule in rules ] - headers = ("Endpoint", "Methods", "Rule") + headers = ("Sub Domain","Endpoint", "Methods", "Rule") widths = ( + max(len(rule.subdomain) for rule in rules), max(len(rule.endpoint) for rule in rules), max(len(methods) for methods in rule_methods), max(len(rule.rule) for rule in rules), ) 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(*("-" * width for width in widths))) 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(