management.completers

Shell completion helpers for renderstatic related management commands.

render_static.management.completers.complete_selector(ctx, param, incomplete, engine=None)[source]

Generate completions for the template selectors and the given or default engines.

To use this completer with a non-default engine you can bind the engine parameter:

from render_static.engine import StaticTemplateEngine
from render_static.management.completers import complete_selector
from functools import partial

custom_engine = StaticTemplateEngine(...)

Argument(
    help=_("..."),
    shell_complete=partial(complete_selector, engine=custom_engine),
)
Parameters:
  • ctx (Context) – The Click context.

  • param (Parameter) – The Click parameter.

  • incomplete (str) – The incomplete selector string.

  • engine (StaticTemplateEngine | None) – An optional StaticTemplateEngine to use for searching.

Returns:

A list of CompletionItem objects representing possible completions.

Return type:

List[CompletionItem]