Update loadkey to use new yaml config
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
55bd8d2eb8
commit
59afe8a585
1 changed files with 6 additions and 4 deletions
|
@ -14,20 +14,21 @@ import sys
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import os.path
|
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():
|
def main():
|
||||||
try:
|
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:
|
except:
|
||||||
print('Could not find origin, not loading key.')
|
print('Could not find origin, not loading key.')
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if os.path.isfile(CONFIG):
|
if os.path.isfile(CONFIG):
|
||||||
combinations = json.loads(open(CONFIG).read())
|
combinations = yaml.safe_load(open(CONFIG).read())
|
||||||
else:
|
else:
|
||||||
print('Config ({}) found.'.format(CONFIG))
|
print('Config ({}) found.'.format(CONFIG))
|
||||||
return 1
|
return 1
|
||||||
|
@ -46,5 +47,6 @@ def main():
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
exit(main())
|
exit(main())
|
||||||
|
|
Loading…
Reference in a new issue