INNER CODE UNIT · Python
tab_content
pluralsh/plural · bin/docgen.py:46
def tab_content(repo, recipe):
start = '{% tab title="' + recipe['provider'] + '" %}'
mid = f"plural bundle install {repo} {recipe['name']}"
end = '{% endtab %}'
return f"{start} {mid} {end}"
def setup_vals(section):
return "\n\n".join(f"`{c['name']}`: {c.get('longform') or c['documentation']}" for c in section['configuration'])
@click.command()
@click.argument("repo")
def docgen(repo):
client = gql_client()
recipes = client.execute(query=recipes_q, variables={'repoName': repo})
recipes = [r['node'] for r in recipes['data']['recipes']['edges']]
recipe = client.execute(query=recipe_q, variables={'id': recipes[0]['id']})['data']['recipe']
tabs = " ".join(tab_content(repo, r) for r in recipes)
repo_name = repo.capitalize()