-
Notifications
You must be signed in to change notification settings - Fork 57
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
_get_lazyload_commands is is passing the multicommand to itself instead of the Context #70
Comments
I am also observing this issue. In my project, when I attempt to generate docs, I get:
It is occurring as I am trying to implement a custom MultiCommand class to load subcommands from plugins, very much as described in the click docs: https://click.palletsprojects.com/en/latest/commands/#custom-multi-commands You can see my custom implementation here: https://github.com/overhangio/tutor/pull/599/files#diff-135f3cab863e666db1ab4b3c1a36f125f11501065e0cae258d73d706b5dfae56R30 The context argument (which is here a MultiCommand) that is passed to The fix should be relatively straightforward and I can open a PR. Would you be interested? Is a unit test necessary? |
I'd definitely be interested. Tests would be appreciated since they prove things are working as expected. Ideally there would be two commits: one to add (failing) unit test(s) and one to fix the bug and the test. Just try your best and let me know if you really can't figure it out. |
Fixing this would likely unblock #83 also. |
A previous fix partially resolve an issue with incorrect command type passed to list_commands, but the same fix should have been applied to get_command as well. Close click-contrib#70 (again).
Unfortunately the proposed fix does not 100% resolve this issue. The context must also be passed to |
The signature for
click.MutliCommand.list_commands
takes aClick.Context
:click.MultiCommand.get_commands
is similar:get_command(self, ctx, cmd_name)
The function in
sphinx-click
to get commands from amulticommand
is passing themulticommand
to itself (instead of theContext
) inlist_commands
andget_commands
:Instead, it should take the context from its caller and pass it to list_commands:
I'm using click version 7.0, and can see the same code in the latest master (
297150c7566a38fb672828a36b681792513d99b0
).My sphinx-click does not have a
__version__
attribute, but I can see the same code cited above in the latest master (6b928ee1b83e3a554d040d19e95bd3063e464c60
)The text was updated successfully, but these errors were encountered: