module documentation

Undocumented

Class BashComplete Shell completion for Bash.
Class CompletionItem Represents a completion value and metadata about the value. The default metadata is ``type`` to indicate special shell handling, and ``help`` if a shell supports showing a help string next to the value.
Class FishComplete Shell completion for Fish.
Class ShellComplete Base class for providing shell completion support. A subclass for a given shell will override attributes and methods to implement the completion instructions (``source`` and ``complete``).
Class ZshComplete Shell completion for Zsh.
Function add_completion_class Register a :class:`ShellComplete` subclass under the given name. The name will be provided by the completion instruction environment variable during completion.
Function get_completion_class Look up a registered :class:`ShellComplete` subclass by the name provided by the completion instruction environment variable. If the name isn't registered, returns ``None``.
Function shell_complete Perform shell completion for the given CLI program.
Function _is_incomplete_argument Determine if the given parameter is an argument that can still accept values.
Function _is_incomplete_option Determine if the given parameter is an option that needs a value.
Function _resolve_context Produce the context hierarchy starting with the command and traversing the complete arguments. This only follows the commands, it doesn't trigger input prompts or callbacks.
Function _resolve_incomplete Find the Click object that will handle the completion of the incomplete value. Return the object and the incomplete value.
Function _start_of_option Check if the value looks like the start of an option.
Constant _SOURCE_BASH Undocumented
Constant _SOURCE_FISH Undocumented
Constant _SOURCE_ZSH Undocumented
Variable _available_shells Undocumented
def add_completion_class(cls, name=None): (source)

Register a :class:`ShellComplete` subclass under the given name. The name will be provided by the completion instruction environment variable during completion. :param cls: The completion class that will handle completion for the shell. :param name: Name to register the class under. Defaults to the class's ``name`` attribute.

Parameters
name:t.Optional[str]Undocumented
def get_completion_class(shell): (source)

Look up a registered :class:`ShellComplete` subclass by the name provided by the completion instruction environment variable. If the name isn't registered, returns ``None``. :param shell: Name the class is registered under.

Parameters
shell:strUndocumented
Returns
t.Optional[t.Type[ShellComplete]]Undocumented
def shell_complete(cli, ctx_args, prog_name, complete_var, instruction): (source)

Perform shell completion for the given CLI program. :param cli: Command being called. :param ctx_args: Extra arguments to pass to ``cli.make_context``. :param prog_name: Name of the executable in the shell. :param complete_var: Name of the environment variable that holds the completion instruction. :param instruction: Value of ``complete_var`` with the completion instruction and shell, in the form ``instruction_shell``. :return: Status code to exit with.

Parameters
cli:BaseCommandUndocumented
ctx_args:t.Dict[str, t.Any]Undocumented
prog_name:strUndocumented
complete_var:strUndocumented
instruction:strUndocumented
Returns
intUndocumented
def _is_incomplete_argument(ctx, param): (source)

Determine if the given parameter is an argument that can still accept values. :param ctx: Invocation context for the command represented by the parsed complete args. :param param: Argument object being checked.

Parameters
ctx:ContextUndocumented
param:ParameterUndocumented
Returns
boolUndocumented
def _is_incomplete_option(ctx, args, param): (source)

Determine if the given parameter is an option that needs a value. :param args: List of complete args before the incomplete value. :param param: Option object being checked.

Parameters
ctx:ContextUndocumented
args:t.List[str]Undocumented
param:ParameterUndocumented
Returns
boolUndocumented
def _resolve_context(cli, ctx_args, prog_name, args): (source)

Produce the context hierarchy starting with the command and traversing the complete arguments. This only follows the commands, it doesn't trigger input prompts or callbacks. :param cli: Command being called. :param prog_name: Name of the executable in the shell. :param args: List of complete args before the incomplete value.

Parameters
cli:BaseCommandUndocumented
ctx_args:t.Dict[str, t.Any]Undocumented
prog_name:strUndocumented
args:t.List[str]Undocumented
Returns
ContextUndocumented
def _resolve_incomplete(ctx, args, incomplete): (source)

Find the Click object that will handle the completion of the incomplete value. Return the object and the incomplete value. :param ctx: Invocation context for the command represented by the parsed complete args. :param args: List of complete args before the incomplete value. :param incomplete: Value being completed. May be empty.

Parameters
ctx:ContextUndocumented
args:t.List[str]Undocumented
incomplete:strUndocumented
Returns
t.Tuple[t.Union[BaseCommand, Parameter], str]Undocumented
def _start_of_option(ctx, value): (source)

Check if the value looks like the start of an option.

Parameters
ctx:ContextUndocumented
value:strUndocumented
Returns
boolUndocumented
_SOURCE_BASH: str = (source)

Undocumented

Value
'''%(complete_func)s() {
    local IFS=$\'\\n\'
    local response

    response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD %(comple
te_var)s=bash_complete $1)

...
_SOURCE_FISH: str = (source)

Undocumented

Value
'''function %(complete_func)s;
    set -l response;

    for value in (env %(complete_var)s=fish_complete COMP_WORDS=(commandline -cp
) COMP_CWORD=(commandline -t) %(prog_name)s);
        set response $response $value;
    end;
...
_SOURCE_ZSH: str = (source)

Undocumented

Value
'''#compdef %(prog_name)s

%(complete_func)s() {
    local -a completions
    local -a completions_with_descriptions
    local -a response
    (( ! $+commands[%(prog_name)s] )) && return 1
...
_available_shells: t.Dict[str, t.Type[ShellComplete]] = (source)

Undocumented