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
| Name | Type | Description |
|---|---|---|
| cli | click.Command | The Click command object for which completion is being requested. |
| ctx_args | MutableMapping[str, Any] | A mapping of context arguments used to initialize the completion class. |
| prog_name | str | The name of the program as it is invoked on the command line. |
| complete_var | str | The name of the environment variable used to trigger completion. |
| instruction | str | The completion instruction string containing the action and shell type, formatted as 'instruction_shell' (e.g., 'source_bash'). |
Returns
| Type | Description |
|---|---|
int | The exit status code: 0 for success, or 1 if the instruction or shell is invalid or unsupported. |