15 lines
409 B
Python
15 lines
409 B
Python
|
|
from typing import Any, Dict, Sequence
|
||
|
|
import json
|
||
|
|
from ._shared import Cmdlet
|
||
|
|
|
||
|
|
def _run(result: Any, args: Sequence[str], config: Dict[str, Any]) -> int:
|
||
|
|
"""Output the current pipeline result as JSON."""
|
||
|
|
print(json.dumps(result, indent=2, default=str))
|
||
|
|
return 0
|
||
|
|
|
||
|
|
CMDLET = Cmdlet(
|
||
|
|
name="output-json",
|
||
|
|
summary="Output the current pipeline result as JSON.",
|
||
|
|
usage="... | output-json",
|
||
|
|
)
|