-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support for autocompletion of arguments #428
Support for autocompletion of arguments #428
Conversation
@cbandera did you get any feedback? I would love to see a feature like this merged into the library. |
Just wanted to add my support for this feature - it's really useful! :) @mitsuhiko, do you have any thoughts on this pull request? |
The callback receives the following data: - The current click context. This allows the callback to access any parameters that are already present on the command line. - The current word being completed. This may be an empty string. - The bash COMP_CWORDS and COMP_CWORD variables, in case the callback wants to do raw parsing of this data.
+1 from me. Nitpicking a bit here but |
@cbandera: I've been thinking about dynamically generating the suggestions. What do you think about allowing |
@bb4242 I have tested your additions and I think they are a good extension. I had thought about callback functions before too. But before I merge your additions, could you please add Documentation (in the docs directory) and an example file (in examples) to the repo? @con-f-use Good point. I like |
Feature/parameter autocompletion
I've noticed two other small problems while using this feature, which are illustrated in a modified version of the
I think this has to do with the way the |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Completion of arguments is not working for me, but I'm not sure if I'm doing it right. My CLI frontend (can be seen here ) has sub commands and lots of options, options and subcommands all complete well. What I would expect:
Is this intended to work with the above patches being merged in master ? |
This PR no longer appears relevant. |
Is this released then? I'm using 6.7 and still don't see this working. |
I'm not sure what's going on with 6, but autocompletion for Bash and ZSH will definitely be in 7 when that's released. |
Hi,
this is an enhancement to support autocompletion of arguments, as discussed in issue #241.
With this version of click, it is possible to add optional autocomplete suggestions to an argument. This is done by passing a list of str's via the
autocompletion
parameter in the argument decorator:I have added example code and altered the documentation to include the new feature.
Notes:
Looking forward to your feedback