diff --git a/tk-readme-generator.py b/tk-readme-generator.py index c15a82b..f128d66 100644 --- a/tk-readme-generator.py +++ b/tk-readme-generator.py @@ -108,9 +108,19 @@ def table(cols: list[str], rows: list[list[str]]) -> str: readme += "\n\n" +if "documentation_url" in info: + readme += f"[![Documentation](https://img.shields.io/badge/documentation-blue?style=for-the-badge)]({info['documentation_url']})\n" +if "support_url" in info: + readme += f"[![Support](https://img.shields.io/badge/support-orange?style=for-the-badge)]({info['support_url']})\n" +if "documentation_url" in info or "support_url" in info: + readme += "\n" + if "description" in info: readme += f"{info['description']}\n\n" +if "supported_engines" in info and info["supported_engines"] is not None: + readme += f"> Supported engines: {', '.join(info['supported_engines'])}\n\n" + # Prepend readme file if args.prepend is not None and args.prepend != "": prepend_filepath = Path(args.prepend) @@ -119,9 +129,6 @@ def table(cols: list[str], rows: list[list[str]]) -> str: readme += prepend_file.read() readme += "\n\n" -if "supported_engines" in info: - readme += f"> Supported engines: {', '.join(info['supported_engines'])}\n\n" - readme += "## Requirements\n\n" requires_shotgun_version = "-" @@ -151,24 +158,44 @@ def table(cols: list[str], rows: list[list[str]]) -> str: ], ) -requires_shotgun_fields = "-" if "requires_shotgun_fields" in info and info["requires_shotgun_fields"] is not None: - requires_shotgun_fields = info["requires_shotgun_fields"] -readme += f"**ShotGrid fields:** {requires_shotgun_fields}\n\n" + readme += "### ShotGrid fields:\n\n" + for key, value in info["requires_shotgun_fields"].items(): + readme += f"**{key}:**\n" + for field in value: + readme += f"- {field['system_name']} `{field['type']}`\n" + readme += "\n" -frameworks = "-" if "frameworks" in info and info["frameworks"] is not None: - frameworks = ", ".join(info["frameworks"]) -readme += f"**Frameworks:** {frameworks}\n\n" + readme += "**Frameworks:**\n\n" + readme += table( + ["Name", "Version", "Minimum version"], + list( + map( + lambda framework: [ + framework["name"], + framework["version"], + framework.get("minimum_version", ""), + ], + info["frameworks"], + ) + ), + ) + readme += "\n\n" config_names = { "str": "Strings", + "int": "Integers", "bool": "Booleans", "dict": "Dictionaries", "list": "Lists", "config_path": "Config paths", "template": "Templates", + "publish_type": "Publish types", "hook": "Hooks", + "shotgun_entity_type": "ShotGrid entity types", + "shotgun_permission_group": "ShotGrid permission groups", + "shotgun_filter": "ShotGrid filters", } if "configuration" in info and info["configuration"] is not None: readme += "## Configuration\n\n"