paths = []
output = {}
-for arg in sys.argv[1:]:
- if os.path.isdir(arg):
- for path in Path(arg).rglob('*.json'):
- paths.append(path)
- elif os.path.isfile(arg) and arg.endswith('.json'):
- paths.append(arg)
- else:
- sys.stderr.write("Not a directory and not a .json file: {} => abort\n".format(arg))
- exit(1)
+if len(sys.argv) != 2:
+ sys.stderr.write("Merge json files generated by OpenWrt.\n\nUsage: {} <openwrt-bin-dir>\n\nThe result will be printed to stdout.\n".format(sys.argv[0]))
+ exit(1)
+for path in Path(sys.argv[1]).rglob('*.json'):
+ paths.append(path)
def collect_names(prefix, images):
names = []