TyperPath
This class extends the standard path parameter type to ensure compatibility with specific command-line autocompletion systems. It overrides default shell completion behavior by returning an empty list, allowing external completion logic to function correctly. This ensures that path-based arguments integrate seamlessly with the surrounding CLI framework's completion engine.
Methods
shell_complete()
@classmethod
def shell_complete(
ctx: click.Context,
param: click.Parameter,
incomplete: str
) - > list[click.shell_completion.CompletionItem]
Return an empty list so that the autocompletion functionality will work properly from the commandline.
Parameters
| Name | Type | Description |
|---|---|---|
| ctx | click.Context | The current Click context object representing the command execution state |
| param | click.Parameter | The parameter object that this path completion is being requested for |
| incomplete | str | The partial string entered by the user on the command line to be completed |
Returns
| Type | Description |
|---|---|
list[click.shell_completion.CompletionItem] | An empty list to allow Typer's native autocompletion system to handle path completion instead of Click's default behavior |