{#-
Parameters:
stage: Git hook stage, eg. pre-commit
-#}
#!/usr/bin/env python
#
# A hook wrapper generated by https://www.github.com/metov/yaghm

from pathlib import Path
import subprocess

print(f"Running {{ stage }} hooks...")

p = Path(".git/hooks/{{ stage }}.yaghm.commands")
all_cmds = p.read_text().splitlines()

failed = False
for cmd in all_cmds:
  print('')
  res = subprocess.run(cmd, shell=True)
  failed = failed or res.returncode

if failed:
    exit(1)

print('')
print('='*10)
print('')
