2022-11-01 18:34:02 +08:00
|
|
|
import json
|
|
|
|
import pprint
|
|
|
|
import sys
|
|
|
|
|
2022-11-15 06:30:33 +08:00
|
|
|
import rtoml as toml
|
2022-11-01 18:34:02 +08:00
|
|
|
|
2023-12-03 16:54:07 +08:00
|
|
|
with open(sys.argv[1], encoding="utf-8", mode="r") as f:
|
|
|
|
if sys.argv[2] == "parse":
|
2022-11-15 06:30:33 +08:00
|
|
|
a = toml.load(f)
|
|
|
|
b = json.dumps(a)
|
|
|
|
print(b)
|
2022-11-01 18:34:02 +08:00
|
|
|
else:
|
|
|
|
a = json.load(f)
|
|
|
|
print(a)
|
2022-11-01 23:22:39 +08:00
|
|
|
pprint.pprint(a, width=100)
|