Files

26 lines
749 B
Python
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""Action ``uncommitted`` (read-only): a conversation's not-yet-committed changes.
stdin ``{conversationId, stats?: bool}`` → ``DiffResult`` (``stats``: no hunks —
paths and +/− only, what the Details row needs), through the core's
``hub/diff/conversations/{cid}/uncommitted``."""
from __future__ import annotations
import pathlib
import sys
sys.dont_write_bytecode = True
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))
import _lib # noqa: E402
def main(p: dict) -> dict:
stats = bool(p.get("stats"))
out = _lib.uncommitted(_lib.conversation_id(p), stats=stats)
return _lib.strip_hunks(out) if stats and isinstance(out, dict) else out
if __name__ == "__main__":
_lib.run(main)