MCPcopy
hub / github.com/pallets/click / shell_complete

Method shell_complete

src/click/core.py:2030–2047  ·  view source on GitHub ↗

Return a list of completions for the incomplete value. Looks at the names of options, subcommands, and chained multi-commands. :param ctx: Invocation context for this command. :param incomplete: Value being completed. May be empty. .. versionadded:: 8.0

(self, ctx: Context, incomplete: str)

Source from the content-addressed store, hash-verified

2028 return cmd_name if cmd else None, cmd, args[1:]
2029
2030 def shell_complete(self, ctx: Context, incomplete: str) -> list[CompletionItem]:
2031 """Return a list of completions for the incomplete value. Looks
2032 at the names of options, subcommands, and chained
2033 multi-commands.
2034
2035 :param ctx: Invocation context for this command.
2036 :param incomplete: Value being completed. May be empty.
2037
2038 .. versionadded:: 8.0
2039 """
2040 from click.shell_completion import CompletionItem
2041
2042 results = [
2043 CompletionItem(name, help=command.get_short_help_str())
2044 for name, command in _complete_visible_commands(ctx, incomplete)
2045 ]
2046 results.extend(super().shell_complete(ctx, incomplete))
2047 return results
2048
2049
2050class _MultiCommand(Group, metaclass=_FakeSubclassCheck):

Callers 2

shell_completeMethod · 0.45
get_completionsMethod · 0.45

Calls 3

CompletionItemClass · 0.90
get_short_help_strMethod · 0.80

Tested by

no test coverage detected