diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2013-01-12 03:45:29 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2013-01-12 03:45:29 (GMT) |
commit | 9df864239ea8e66d9385a66a1b5e20cb0f534217 (patch) | |
tree | e92a43a7d35f6bdb27a8ecd3446460b9ad44479e /tools | |
parent | ea641e912f201e5e636a7e00fef18cc74e3d23b0 (diff) |
Cleanup config generation
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/json-format | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/tools/json-format b/tools/json-format deleted file mode 100755 index dde3cb0..0000000 --- a/tools/json-format +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python - -import argparse -import json -from operator import itemgetter - -parser = argparse.ArgumentParser() -parser.add_argument("paths", nargs="+", help="path to the json file") -parser.add_argument("--sort-by", help="dictionary key to sort by") -args = parser.parse_args() - -for path in args.paths: - in_file = open(path, "rb") - data = json.load(in_file) - in_file.close() - - if args.sort_by is not None: - data.sort(key=itemgetter(args.sort_by)) - - out_file = open(path, "wb") - json.dump(data, out_file, sort_keys=True, indent=4) - out_file.write('\n') - out_file.close() |