jjlj
This commit is contained in:
14
cmdlets/output_json.py
Normal file
14
cmdlets/output_json.py
Normal file
@@ -0,0 +1,14 @@
|
||||
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",
|
||||
)
|
||||
Reference in New Issue
Block a user