mirror of https://github.com/hrfee/jfa-go
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
755 B
28 lines
755 B
4 years ago
|
import json, argparse
|
||
4 years ago
|
|
||
4 years ago
|
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:
|
||
4 years ago
|
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]
|
||
|
|
||
4 years ago
|
with open(args.output, 'w') as f:
|
||
4 years ago
|
f.write(json.dumps(newconfig, indent=4))
|
||
|
|
||
|
|