Register debug group in main.py with districts subcommand and tests
This commit is contained in:
parent
7a35489f35
commit
2196e256f4
2 changed files with 80 additions and 0 deletions
24
main.py
24
main.py
|
|
@ -470,5 +470,29 @@ def calculate_poi(poi_id: int, travel_modes: str, listing_type: str) -> None:
|
|||
click.echo(f"Computed {total} distances")
|
||||
|
||||
|
||||
from cli._context import CliContext
|
||||
from cli.districts import districts_group
|
||||
|
||||
|
||||
@cli.group("debug")
|
||||
@click.option("--user-email", "-u", required=True, help="Email of user to impersonate")
|
||||
@click.option("--http", "use_http", is_flag=True, default=False, help="Use HTTP requests instead of direct service calls")
|
||||
@click.option("--json", "json_output", is_flag=True, default=False, help="Output in JSON format")
|
||||
@click.option("--api-url", default="http://localhost:8000", help="API base URL for HTTP mode")
|
||||
@click.pass_context
|
||||
def debug(ctx: click.Context, user_email: str, use_http: bool, json_output: bool, api_url: str) -> None:
|
||||
"""Debug CLI — mirrors web UI interactions with superuser access."""
|
||||
ctx.ensure_object(dict)
|
||||
ctx.obj["cli_ctx"] = CliContext(
|
||||
user_email=user_email,
|
||||
use_http=use_http,
|
||||
json_output=json_output,
|
||||
api_base_url=api_url,
|
||||
)
|
||||
|
||||
|
||||
debug.add_command(districts_group)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
cli()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue