capture.py python
18 lines 528 B
Raw
sha256:106ef9e12cca7f3be3ffb2a6bd3abfa76f032dce453c9e5010d732a8d86f2e14 Reconcile reviewed credential compatibility 32254cd939885d9… Human patch 8 days ago
1 """Capture JSON emitted by CLI commands for HTTP handlers."""
2
3 from __future__ import annotations
4
5 from typing import Any
6
7 from cli.output import OutputContext
8
9
10 class CapturingOutputContext(OutputContext):
11 """Output context that records the last JSON payload instead of printing it."""
12
13 def __init__(self) -> None:
14 super().__init__(json_mode=True, quiet=True)
15 self.json_payload: dict[str, Any] | None = None
16
17 def emit_json(self, payload: dict[str, Any]) -> None:
18 self.json_payload = payload
File History 2 commits
sha256:106ef9e12cca7f3be3ffb2a6bd3abfa76f032dce453c9e5010d732a8d86f2e14 Reconcile reviewed credential compatibility 32254cd939885d9… Human patch 8 days ago
sha256:c87cf2c2f03da507f66f93922cb339a2cbebb33ad6372a6039032fb09a20da12 Reconcile reviewed Overseer recovery d47291d5d9030de5ebef71… Human minor ⚠ 8 days ago