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

🐛 Fix shell_complete not working for Arguments #737

Merged
merged 13 commits into from
Aug 16, 2024

Conversation

bckohan
Copy link
Contributor

@bckohan bckohan commented Jan 25, 2024

As pointed out in #334 the shell_complete parameter on Arguments is not called. This is a very simple bug where shell_complete was simply omitted as a parameter passed to TyperArgument.

This PR adds the missing parameter resulting in a one line change in the library and it adds one additional completion test that tests that shell_complete works as expected when given to an Argument.

Copy link

@dbosk dbosk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need get_param_completion to be able to skip some of the parameters for the shell_complete function, such as shell_complete(incomplete: str).

typer/main.py Show resolved Hide resolved
tests/assets/compat_arg_complete_click7_8.py Outdated Show resolved Hide resolved
@svlandeg svlandeg added bug Something isn't working p2 labels Feb 28, 2024
@svlandeg svlandeg linked an issue Apr 19, 2024 that may be closed by this pull request
7 tasks
Copy link
Member

@svlandeg svlandeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! The one line fix seems correct to me, and I can confirm that it fixes the bug that was reported earlier in #334.

Thanks for adding a test! I just moved it out of compat and into test_others.py where there were a few other completion tests as well. Not sure if this is where Tiangolo wants it or someplace else 😇

@svlandeg svlandeg changed the title Fix shell_complete not working for Arguments 🐛 Fix shell_complete not working for Arguments Apr 19, 2024
@tiangolo
Copy link
Member

Great, thank you @bckohan! 🚀

And thanks a lot for the review and help @svlandeg! 🙇

This will be available in Typer 0.12.4 released in the next few hours. 🎉

@tiangolo tiangolo merged commit dcb45b1 into fastapi:master Aug 16, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

typer.Argument with autocompletion
4 participants