anvil/tools/yaml-pretty.py
skudriashev b295086082 Clean-up pep8 E128 warnings
Change-Id: I07617dcb02ae18b5318f9bb4c06e2b10fa38646e
2014-02-14 17:43:20 +02:00

24 lines
617 B
Python
Executable File

#!/usr/bin/env python
import sys
import yaml
# See: http://pyyaml.org/wiki/PyYAMLDocumentation
if __name__ == "__main__":
args = list(sys.argv)
args = args[1:]
for fn in args:
fh = open(fn, 'r')
data = yaml.load(fh.read())
fh.close()
formatted = yaml.dump(data,
line_break="\n",
indent=4,
explicit_start=True,
explicit_end=True,
default_flow_style=False)
print("# Formatted %s" % (fn))
print(formatted)