Skip to content

Commit

Permalink
fix(scripts/generate_readme): add missing main() invocation; ensure d…
Browse files Browse the repository at this point in the history
…edent; ignore some internal layout commands
  • Loading branch information
aravinda0 committed Jan 18, 2024
1 parent 370cf4f commit 1580fbd
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions scripts/generate_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,35 @@ def get_config_options(layout_cls: type[Layout]) -> list:
{
"name": option[0],
"default": option[1],
"description": rewrap(description, width=100, html_whitespace=True),
"description": rewrap(
description, width=80, dedent=True, html_whitespace=True
),
}
)

return config_options


def get_exposed_comands(layout_cls: type[Layout]) -> list:
excluded_commands = {
"info",
}
commands = []

def is_exposed_command(node):
expose_command_decorator = next(
(d for d in node.decorator_list if d.id == "expose_command"), None
)
if expose_command_decorator is not None:
if expose_command_decorator is not None and node.name not in excluded_commands:
docstring = ast.get_docstring(node)
if docstring is None:
raise ValueError(f"The `{node.name}` command is missing documentation")
commands.append(
{
"name": node.name,
"docstring": rewrap(docstring, width=100, html_whitespace=True),
"docstring": rewrap(
docstring, width=100, dedent=True, html_whitespace=True
),
}
)

Expand All @@ -75,3 +82,7 @@ def is_exposed_command(node):
v.visit(ast.parse(inspect.getsource(layout_cls)))

return commands


if __name__ == "__main__":
main()

0 comments on commit 1580fbd

Please sign in to comment.