Skip to content

Commit

Permalink
Merge pull request #3 from MaximumFX/dev
Browse files Browse the repository at this point in the history
Update main from dev
  • Loading branch information
MaximumFX authored Apr 10, 2024
2 parents cf5a267 + a63638b commit ca4a9b5
Showing 1 changed file with 36 additions and 9 deletions.
45 changes: 36 additions & 9 deletions tk-readme-generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 = "-"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit ca4a9b5

Please sign in to comment.