Update loadkey to use new yaml config

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2024-06-24 14:57:27 +02:00
parent 55bd8d2eb8
commit 59afe8a585
Signed by: luzifer
SSH Key Fingerprint: SHA256:/xtE5lCgiRDQr8SLxHMS92ZBlACmATUmF1crK16Ks4E

View File

@ -14,20 +14,21 @@ import sys
import re
import subprocess
import os.path
import json
import yaml
CONFIG = os.path.expanduser('~/.config/git-committerconfig.json')
CONFIG = os.path.expanduser('~/.config/git-committerconfig.yaml')
def main():
try:
repos = [x.split()[1] for x in subprocess.check_output(['git', 'remote', '-v'], universal_newlines=True).split('\n') if len(x.strip()) > 0]
repos = [x.split()[1] for x in subprocess.check_output(
['git', 'remote', '-v'], universal_newlines=True).split('\n') if len(x.strip()) > 0]
except:
print('Could not find origin, not loading key.')
return 0
if os.path.isfile(CONFIG):
combinations = json.loads(open(CONFIG).read())
combinations = yaml.safe_load(open(CONFIG).read())
else:
print('Config ({}) found.'.format(CONFIG))
return 1
@ -46,5 +47,6 @@ def main():
return 0
if __name__ == "__main__":
exit(main())