diff --git a/scripts/yaml-toml.py b/scripts/yaml-toml.py index adaa406..8b70bc9 100755 --- a/scripts/yaml-toml.py +++ b/scripts/yaml-toml.py @@ -10,6 +10,7 @@ import json # pip install toml deepdiff + def _yaml_load(path): """load from yaml""" with open(path, 'r', encoding='utf8') as file: @@ -18,6 +19,7 @@ def _yaml_load(path): content = data.load(file) return content + def _yaml_dump(content, where): """dump to yaml""" data = yaml() @@ -26,6 +28,7 @@ def _yaml_dump(content, where): data.typ = 'rt' data.dump(content, where) + def _toml_load(path): """load from toml""" with open(path, 'r', encoding='utf8') as file: @@ -33,10 +36,12 @@ def _toml_load(path): content = toml.loads(data) return content + def _toml_dump(content, where): with open(where, 'w') as f: toml.dump(content, f) + if __name__ == '__main__': if len(sys.argv) < 3: print("usage:")