Skip to content
Myr

Always add autocomplete to Param

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Nicholas Wiles · committed by Nicholas Wiles · parent ba4f40a · Browse files · 3 files+4 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+4 added−5 removed

  • other:+4 added−5 removed

3 files+4 added−5 removed

modified:click/_bashcomplete.py+1 added-1 removed
105 unmodified lines
106 """107 choices = []108 if isinstance(cmd_param.type, Choice):109 choices.extend(cmd_param.type.choices)110 elif hasattr(cmd_param, 'autocompletion'):110 elif cmd_param.autocompletion is not None:111 choices.extend(cmd_param.autocompletion(ctx=ctx,112 args=args,113 incomplete=incomplete))114 return choices
79 unmodified lines
modified:click/core.py+1 added-2 removed
1288 unmodified lines
1289 self.default = default1290 self.is_eager = is_eager1291 self.metavar = metavar1292 self.envvar = envvar1293 if autocompletion is not None:1294 self.autocompletion = autocompletion1293 self.autocompletion = autocompletion12941295 @property1296 def human_readable_name(self):1297 """Returns the human readable name of this parameter. This is the
459 unmodified lines
modified:docs/bashcomplete.rst+2 added-2 removed
27 unmodified lines
28 clone commit copy delete setuser29 $ repo clone -<TAB><TAB>30 --deep --help --rev --shallow -r3132Additionally, custom suggestions can be provided for arguments with the33``autocompletion`` parameter. ``autocompletion`` should a callback function32Additionally, custom suggestions can be provided for arguments and options with33the ``autocompletion`` parameter. ``autocompletion`` should a callback function34that returns a list of strings. This is useful when the suggestions need to be35dynamically generated at bash completion time. The callback function will be36passed 3 keyword arguments:37
69 unmodified lines