Skip to main content

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

NameTypeDescription
ctxclick.ContextThe current Click context object representing the command execution state
paramclick.ParameterThe parameter object that this path completion is being requested for
incompletestrThe partial string entered by the user on the command line to be completed

Returns

TypeDescription
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