28 lines
632 B
Python
28 lines
632 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
|
|
import sys,json,argparse
|
|
|
|
text = sys.stdin.readlines()
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("-f","--file")
|
|
args = parser.parse_args()
|
|
|
|
config = {}
|
|
|
|
for i in range(len(text)):
|
|
if '#' not in text[i] and len(str(text[i]).strip())>0:
|
|
key = str(text[i]).strip().split('=')
|
|
config[str(key[0])]=str(key[1])
|
|
|
|
with open(args.file,'r',encoding='utf-8') as f:
|
|
changes = json.loads(f.read())
|
|
|
|
for c in changes.keys():
|
|
config[str(c)]=changes[str(c)]
|
|
|
|
config_to_write = ['='.join([str(i),str(config[str(i)])]) for i in config.keys()]
|
|
|
|
print('\n'.join(config_to_write))
|