Improve completion by delegating to Click #25
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously we generated our own completions for available options and commands, in a similar way to how this was is done in the
click._bashcomplete
module.However, this module has had various improvements made to it since this was originally done. Rather than duplicate similar code here (and have to do this again in future), this commit changes our completion to
delegate generating the available completions to Click. There is also additional handling around this to still display relevant help alongside the completions, where possible.
The end result is that this commit should make click-repl's completion function as before, except with some additional completions shown where these are relevant, such as the completion of choices added in
pallets/click#681. Any additional improvements to Click's completion will also become available to us.