+class GitCommand:
+ def __getattr__(self, name):
+ def call(*args, get_stderr = False):
+ cmd = ["git", name.replace('_', '-')] + list(args)
+ output = subprocess.check_call(cmd, stderr=subprocess.STDOUT if get_stderr else None)
+ return output.decode('utf-8').strip('\n')
+ return call
+git = GitCommand()
+