Skip to content

Redefine click.pass_context and click.get_current_context to use cloup.Context in place of click.Context - #171

Merged
janluke merged 3 commits into
janluke:masterfrom
oeko2002:pass_context_fix
Nov 13, 2023
Merged

Redefine click.pass_context and click.get_current_context to use cloup.Context in place of click.Context#171
janluke merged 3 commits into
janluke:masterfrom
oeko2002:pass_context_fix

Conversation

@oeko2002

@oeko2002 oeko2002 commented Nov 10, 2023

Copy link
Copy Markdown

This PR redefines click.pass_context and click.get_current_context so that the type of the returned Context object is cloup.Context and not click.Context.

I (@janluke) used @overload to provide better type annotations for cloup.get_current_context: if the silent argument is not provided, the return type is Context, not Optional[Context].

@oeko2002

Copy link
Copy Markdown
Author

Would be good for somebody experienced to review. I am no full time dev.

@janluke janluke added the enhancement New feature or request label Nov 13, 2023
@janluke janluke changed the title Add cloup.pass_context being compatible with cloup.context Redefine click.pass_context and click.get_current_context to use cloup.Context in place of click.Context Nov 13, 2023
@janluke

janluke commented Nov 13, 2023

Copy link
Copy Markdown
Owner

@oeko2002 The PR was fine, thanks. I added get_current_context which presented the same problem as pass_context and moved the code up.

@janluke
janluke merged commit 1d2a47f into janluke:master Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants