Skip to main content

show_callback

Generates and prints the shell completion script for the current program and then exits the process. It detects the user's shell environment, retrieves the appropriate completion script content, and outputs it to the terminal using click.echo.

def show_callback(
ctx: click.Context,
param: click.Parameter,
value: Any
) - > Any

Generates and prints the shell completion script for the current CLI application and then exits the process.

Parameters

NameTypeDescription
ctxclick.ContextThe Click context object used to find the root program name and check for resilient parsing.
paramclick.ParameterThe Click parameter object associated with this callback.
valueAnyThe value passed to the parameter, which can optionally specify a target shell name as a string.

Returns

TypeDescription
AnyReturns the input value if the context is in resilient parsing mode or if the value is empty; otherwise, the function terminates the program after printing the script.