From 16f5a9bb5607e19a9b1577449dd8184357122382 Mon Sep 17 00:00:00 2001 From: Federico Ressi Date: Thu, 4 Jul 2019 10:38:51 +0200 Subject: [PATCH] Add tool to print out yaml file to js format Change-Id: Ic98e3075c42b70b9430ca500502ef4f566b749ac --- tools/ci/yaml2js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 tools/ci/yaml2js diff --git a/tools/ci/yaml2js b/tools/ci/yaml2js new file mode 100755 index 000000000..dd156ff3a --- /dev/null +++ b/tools/ci/yaml2js @@ -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()