From: Moritz Warning Date: Sun, 2 Feb 2020 14:34:23 +0000 (+0100) Subject: add help text to python script X-Git-Tag: v1.0.0~27 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=b5a59d1f4700a94163003e076864fdf981416ad7;p=web%2Ffirmware-selector-openwrt-org.git add help text to python script --- diff --git a/collect.py b/collect.py index 09e0c64..3472110 100755 --- a/collect.py +++ b/collect.py @@ -11,16 +11,12 @@ SUPPORTED_METADATA_VERSION = 1 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: {} \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 = []