def main()

in tools/manifest.py [0:0]


def main():
    opts = parse_opts()
    filepath = opts.path
    image = opts.image
    mode = opts.mode
    version_file = opts.file

    if mode == "tags":
        tags = []
        with open(version_file, "r") as f:
            versions = json.load(f).get("versions")
            # Filter the specific dockerfile
            versions = list(filter(lambda x: x.get("path") == filepath, versions))
            # Get matched version's tags
            tags = versions[0]["tags"] if versions else []
        print(",".join(["%s:%s" % (image, t) for t in tags]))
    elif mode == "manifest":
        with open(version_file, "r") as f:
            versions = json.load(f).get("versions")
            print(generate_manifest(versions))