get_callback
Wraps a callback function to handle parameter mapping, type conversion, and Click context injection while preserving the original function's metadata.
def get_callback(
callback: Callable[..., Any] | None = None,
params: Sequence[click.Parameter] = [],
convertors: dict[str, Callable[[str], Any]] | None = None,
context_param_name: str | None = None,
pretty_exceptions_short: bool
) - > Callable[..., Any] | None
Wraps a provided callback function to handle parameter mapping, type conversion, and Click context injection. Use this to ensure that CLI arguments are correctly processed and passed to the underlying execution logic with optional traceback styling.
Parameters
| Name | Type | Description |
|---|---|---|
| callback | `Callable[..., Any] | None` = None |
| params | Sequence[click.Parameter] = [] | A sequence of Click parameter objects used to initialize default values for the callback arguments. |
| convertors | `dict[str, Callable[[str], Any]] | None` = None |
| context_param_name | `str | None` = None |
| pretty_exceptions_short | bool | A flag that controls the Rich traceback guard to determine if shortened exception formatting should be applied during execution. |
Returns
| Type | Description |
|---|---|
| `Callable[..., Any] | None` |