diff --git a/src/apighost/cli.py b/src/apighost/cli.py index ac8342e..8ff95e2 100644 --- a/src/apighost/cli.py +++ b/src/apighost/cli.py @@ -1,4 +1,4 @@ -"""APIGhost CLI entry point — OpenAPI spec to mock server.""" +"""APIGhost CLI entry point - OpenAPI spec to mock server.""" from __future__ import annotations @@ -59,7 +59,7 @@ def serve(spec, port, host, scenario, record, cassette_name, latency, watch): apighost serve spec.yaml --scenario error_400 apighost serve spec.yaml --record --cassette-name my-test """ - click.echo(f" APIGhost v{__version__} — loading spec...") + click.echo(f" APIGhost v{__version__} - loading spec...") click.echo(f" Spec: {spec}") try: @@ -113,10 +113,10 @@ def serve(spec, port, host, scenario, record, cassette_name, latency, watch): def _on_shutdown(recorder, cassette_name, spec_path): - """Handle server shutdown — save cassette if recording.""" + """Handle server shutdown - save cassette if recording.""" if recorder and recorder.count > 0: path = recorder.save(cassette_name or f"recording-{int(time.time())}", spec_path) - click.echo(f"\n Recorded {recorder.count} interactions → {path}") + click.echo(f"\n Recorded {recorder.count} interactions → {path}") click.echo("\n Server stopped.") @@ -169,14 +169,14 @@ def record(spec, output, port, requests): click.echo(f" {ep.method:>6} {resp.status_code} {filled_path}") count += 1 except Exception as e: - click.echo(f" {ep.method:>6} ERROR {filled_path} — {e}") + click.echo(f" {ep.method:>6} ERROR {filled_path} - {e}") # Determine output if not output: output = f"cassette-{api_spec.title.replace(' ', '-').lower()}-{int(time.time())}" path = recorder.save(output, spec) - click.echo(f"\n Recorded {recorder.count} interactions → {path}") + click.echo(f"\n Recorded {recorder.count} interactions → {path}") return path @@ -196,7 +196,7 @@ def replay(cassette, port, host): click.echo(f" Error: {e}", err=True) sys.exit(1) - click.echo(f" APIGhost — replaying cassette: {cassette_data.name}") + click.echo(f" APIGhost - replaying cassette: {cassette_data.name}") click.echo(f" Interactions: {len(cassette_data.interactions)}") if cassette_data.spec_path: click.echo(f" Original spec: {cassette_data.spec_path}") @@ -224,7 +224,7 @@ def _replay_handler(path): @app.route("/") def _replay_home(): return jsonify({ - "service": f"APIGhost Replay — {cassette_data.name}", + "service": f"APIGhost Replay - {cassette_data.name}", "interactions": len(cassette_data.interactions), "endpoints": list(set(f"{i.request_method} {i.request_path}" for i in cassette_data.interactions)), @@ -275,7 +275,7 @@ def cassette_info(name): click.echo() for i, interaction in enumerate(data.interactions, 1): click.echo(f" {i}. {interaction.request_method} {interaction.request_path}") - click.echo(f" → {interaction.response_status}") + click.echo(f" → {interaction.response_status}") @cli.group() @@ -303,7 +303,7 @@ def scenario_list(): def scenario_create(name, description): """Create a new empty scenario.""" path = save_scenario(name, description) - click.echo(f" Created scenario '{name}' → {path}") + click.echo(f" Created scenario '{name}' → {path}") @scenario.command("edit") @@ -331,7 +331,7 @@ def scenario_edit(name, route, status, body): sc.overrides[route] = {"status": status, "body": parsed_body} save_scenario(sc.name, sc.description, sc.overrides) - click.echo(f" Updated scenario '{name}' — overrides: {len(sc.overrides)}") + click.echo(f" Updated scenario '{name}' - overrides: {len(sc.overrides)}") @scenario.command("delete") @@ -366,7 +366,7 @@ def generate(spec, output, name): click.echo(f" {ep.method:<6} {ep.path}") path = save_scenario(scenario_name, f"Auto-generated from {spec}", overrides) - click.echo(f"\n Generated {len(overrides)} endpoint responses → {path}") + click.echo(f"\n Generated {len(overrides)} endpoint responses → {path}") @cli.command()