Skip to content

Commit

Permalink
Pass Context, not self, to MultiCommand
Browse files Browse the repository at this point in the history
No tests since we'll rely on type hints to achieve this instead.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Closes: #70
  • Loading branch information
stephenfin committed Apr 7, 2022
1 parent d0552d1 commit 4b8376f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sphinx_click/ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,10 @@ def _format_epilog(ctx):
yield from _format_help(ctx.command.epilog)


def _get_lazyload_commands(multicommand):
def _get_lazyload_commands(ctx):
commands = {}
for command in multicommand.list_commands(multicommand):
commands[command] = multicommand.get_command(multicommand, command)
for command in ctx.command.list_commands(ctx):
commands[command] = ctx.command.get_command(ctx.command, command)

return commands

Expand All @@ -254,7 +254,7 @@ def _filter_commands(ctx, commands=None):
"""Return list of used commands."""
lookup = getattr(ctx.command, 'commands', {})
if not lookup and isinstance(ctx.command, click.MultiCommand):
lookup = _get_lazyload_commands(ctx.command)
lookup = _get_lazyload_commands(ctx)

if commands is None:
return sorted(lookup.values(), key=lambda item: item.name)
Expand Down

0 comments on commit 4b8376f

Please sign in to comment.