Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing documentation for Custom Multi Commands #23

Closed
omercnet opened this issue Mar 11, 2018 · 1 comment
Closed

Missing documentation for Custom Multi Commands #23

omercnet opened this issue Mar 11, 2018 · 1 comment

Comments

@omercnet
Copy link
Contributor

omercnet commented Mar 11, 2018

When using Custom Multi Commands sphinx-click doesn't document the subcommands because multicommand.commands is empty

A quick solution on click's side would be to manually populate the commands attribute by loading all the commands but if you're trying to lazy load on purpose you may cry about performance issues.

class MyGroup(click.MultiCommand):
    """Dynamic group loader class."""

    folder = None

    def __init__(self, **kwargs):
        click.MultiCommand.__init__(self, **kwargs)
        self.commands = self._get_commands()

    def _get_commands(self):
        commands = {}
        for command in self.list_commands(self):
            commands[command] = self.get_command(self, command)

        return commands

I also patched a partial fix in omercnet@7497618 but it doesn't show the MultiCommand name in the docs (returns None), if anyone is willing to help finish it off that would be great :)

@omercnet
Copy link
Contributor Author

The issue was that I didn't assign the name property to the custom command, opened #25

stephenfin pushed a commit that referenced this issue Apr 25, 2018
When using Custom Multi Commands sphinx-click doesn't document the
subcommands because 'multicommand.commands' is empty. Resolve this.

Fixes: #23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants