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

CommandCollection doesn't run the callback from original group #1179

Closed
ghost opened this issue Dec 4, 2018 · 1 comment
Closed

CommandCollection doesn't run the callback from original group #1179

ghost opened this issue Dec 4, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented Dec 4, 2018

We have plugins that export a click group which we pull into our command line by composing them together with a CommandCollection. However some of the plugins do important setup in their group callbacks and the CommandCollection doesn't run those.
We've fixed this by replacing the CommandCollection's callback with the group's callback in get_command. I don't know Click well enough to know if this is right but it makes sense to me.

    def get_command(self, ctx, cmd_name):
        for source in self.sources:
            cmd = source.get_command(ctx, cmd_name)
            if cmd is not None:
                self.callback = source.callback
                return cmd
        return None
@jcrotts
Copy link
Contributor

jcrotts commented May 7, 2019

Closing this, as I think it is a duplicate issue of #347 .

Thanks for the work around though, that is helpful. Please reopen if I have misunderstood.

@jcrotts jcrotts closed this as completed May 7, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant