1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-11-14 06:10:10 +00:00
jfa-go/config/fixconfig.py
Harvey Tindall 62621dabb9 CLI flags, start setting up goreleaser, add build scripts
Copied and fixed the build scripts from jf-accounts, added them to the
.goreleaser.yml. Also:
data directory now stored in user's config folder
Handle timeouts in jfapi
Maybe more i forgot about.
2020-08-01 21:20:02 +01:00

28 lines
755 B
Python

import json, argparse
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", help="input config base from jf-accounts")
parser.add_argument("-o", "--output", help="output config base for jfa-go")
args = parser.parse_args()
with open(args.input, 'r') as f:
config = json.load(f)
newconfig = {"order": []}
for sect in config:
newconfig["order"].append(sect)
newconfig[sect] = {}
newconfig[sect]["order"] = []
newconfig[sect]["meta"] = config[sect]["meta"]
for setting in config[sect]:
if setting != "meta":
newconfig[sect]["order"].append(setting)
newconfig[sect][setting] = config[sect][setting]
with open(args.output, 'w') as f:
f.write(json.dumps(newconfig, indent=4))