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

Method shell_complete

src/click/core.py:2767–2788  ·  view source on GitHub ↗

Return a list of completions for the incomplete value. If a ``shell_complete`` function was given during init, it is used. Otherwise, the :attr:`type` :meth:`~click.types.ParamType[t.Any].shell_complete` function is used. :param ctx: Invocation context for this comma

(self, ctx: Context, incomplete: str)

Source from the content-addressed store, hash-verified

2765 return " / ".join(f"'{x}'" for x in hint_list)
2766
2767 def shell_complete(self, ctx: Context, incomplete: str) -> list[CompletionItem]:
2768 """Return a list of completions for the incomplete value. If a
2769 ``shell_complete`` function was given during init, it is used.
2770 Otherwise, the :attr:`type`
2771 :meth:`~click.types.ParamType[t.Any].shell_complete` function is used.
2772
2773 :param ctx: Invocation context for this command.
2774 :param incomplete: Value being completed. May be empty.
2775
2776 .. versionadded:: 8.0
2777 """
2778 if self._custom_shell_complete is not None:
2779 results = self._custom_shell_complete(ctx, self, incomplete)
2780
2781 if results and isinstance(results[0], str):
2782 from click.shell_completion import CompletionItem
2783
2784 results = [CompletionItem(c) for c in results]
2785
2786 return t.cast("list[CompletionItem]", results)
2787
2788 return self.type.shell_complete(ctx, self, incomplete)
2789
2790
2791class Option(Parameter):

Callers

nothing calls this directly

Calls 2

CompletionItemClass · 0.90
shell_completeMethod · 0.45

Tested by

no test coverage detected