29 lines
1.0 KiB
Python
Executable File
29 lines
1.0 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# -*- encoding: utf-8 -*-
|
|
|
|
import json
|
|
from pathlib import Path
|
|
|
|
def main():
|
|
currents = [*Path('.').glob('*.arb')]
|
|
patcheds = [*Path('patch').glob('*.arb')]
|
|
commons = [*(set(x.stem for x in currents) & set(x.stem for x in patcheds))]
|
|
for common in commons:
|
|
patched_p = next(filter(lambda a: a.stem == common, patcheds))
|
|
current_p = next(filter(lambda a: a.stem == common, currents))
|
|
patched = json.loads(patched_p.read_text())
|
|
current = json.loads(current_p.read_text())
|
|
for pk, pv in patched.items():
|
|
if pk in current and pv != current[pk]:
|
|
print(f"UPD@{common} {pk!r}: {current[pk]!r} --> {pv!r}")
|
|
for pk, pv in patched.items():
|
|
if pk not in current:
|
|
print(f"ADD@{common} {pk!r}: null --> {pv!r}")
|
|
# for ck, cv in current.items():
|
|
# if ck not in patched:
|
|
# print(f"DEL@{common} {ck!r}: {cv!r} --> null")
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|