Skip to main content

shell_complete

Handles shell completion requests by parsing instructions, identifying the appropriate shell completion class, and outputting the resulting script or completion suggestions to stdout.

def shell_complete(
cli: click.Command,
ctx_args: MutableMapping[str, Any],
prog_name: str,
complete_var: str,
instruction: str
) - > int

Handles shell completion requests by generating completion scripts or providing completion results for a specific shell environment.

Parameters

NameTypeDescription
cliclick.CommandThe Click command object for which completion is being requested.
ctx_argsMutableMapping[str, Any]A mapping of context arguments used to initialize the completion class.
prog_namestrThe name of the program as it is invoked on the command line.
complete_varstrThe name of the environment variable used to trigger completion.
instructionstrThe completion instruction string containing the action and shell type, formatted as 'instruction_shell' (e.g., 'source_bash').

Returns

TypeDescription
intThe exit status code: 0 for success, or 1 if the instruction or shell is invalid or unsupported.