diff options
Diffstat (limited to 'delivery_merge/utils.py')
-rw-r--r-- | delivery_merge/utils.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/delivery_merge/utils.py b/delivery_merge/utils.py index 2344a13..8935dd7 100644 --- a/delivery_merge/utils.py +++ b/delivery_merge/utils.py @@ -4,6 +4,12 @@ from subprocess import run def sh(prog, *args): + """ Execute a program with arguments + :param prog: str: path to program + :param args: tuple: variadic arguments + Accepts any combination of strings passed as arguments + :returns: subprocess.CompletedProcess + """ command = [prog] tmp = [] for arg in args: @@ -15,11 +21,17 @@ def sh(prog, *args): def git(*args): + """ Execute git commands + :param args: tuple: variadic arguments to pass to git + :returns: subprocess.CompletedProcess + """ return sh('git', *args) def getenv(s): """ Convert string of key pairs to dictionary format + :param s: str: key pairs separated by newlines + :returns: dict: converted key pairs """ return dict([x.split('=', 1) for x in s.splitlines()]) @@ -27,6 +39,7 @@ def getenv(s): @contextmanager def pushd(path): """ Equivalent to shell pushd/popd behavior + :param path: str: path to directory """ last = os.path.abspath(os.getcwd()) os.chdir(path) |