Add tool to print out yaml file to js format
Change-Id: Ic98e3075c42b70b9430ca500502ef4f566b749ac
This commit is contained in:
parent
9e36e39c17
commit
16f5a9bb56
25
tools/ci/yaml2js
Executable file
25
tools/ci/yaml2js
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import json
|
||||||
|
import io
|
||||||
|
import sys
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
|
def main(args=None):
|
||||||
|
args = args or sys.argv[1:]
|
||||||
|
|
||||||
|
if args:
|
||||||
|
input_stream = io.open(args[0], 'rb')
|
||||||
|
args = args[1:]
|
||||||
|
else:
|
||||||
|
input_stream = sys.stdin
|
||||||
|
|
||||||
|
with input_stream:
|
||||||
|
data = yaml.load(input_stream)
|
||||||
|
|
||||||
|
json.dump(data, sys.stdout, indent=4)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
Loading…
Reference in New Issue
Block a user