tzk/tzk/git.py
Soren I. Bjornstad 97a4611d56 update docstrings
2021-08-27 10:06:52 -05:00

18 lines
495 B
Python

import subprocess
from typing import Sequence
def exec(*args: str) -> None:
"Execute a Git command, raising CalledProcessError if the exit code is nonzero."
subprocess.check_call(["git", *args])
def rc(*args: str) -> int:
"Execute a Git command, returning the exit code."
return subprocess.call(["git", *args])
def read(*args: str) -> str:
"Execute a Git command, returning the output as a string."
return subprocess.check_output(["git", *args], text=True).strip()