almanac.completion

rewrite_completion_stream(completions: Iterable[prompt_toolkit.completion.base.Completion], *, text: Optional[str] = None, start_position: Optional[int] = None, display_meta: Optional[str] = None, style: Optional[str] = None, selected_style: Optional[str] = None) → Iterable[prompt_toolkit.completion.base.Completion][source]

Update field(s) of a stream of completions.

class PagePathCompleter[source]

Bases: prompt_toolkit.completion.base.Completer

A completer for paths to an application’s pages.

get_completions(document: prompt_toolkit.document.Document, complete_event: prompt_toolkit.completion.base.CompleteEvent) → Iterable[prompt_toolkit.completion.base.Completion][source]

This should be a generator that yields Completion instances.

If the generation of completions is something expensive (that takes a lot of time), consider wrapping this Completer class in a ThreadedCompleter. In that case, the completer algorithm runs in a background thread and completions will be displayed as soon as they arrive.

Parameters
  • documentDocument instance.

  • complete_eventCompleteEvent instance.

class WordCompleter(words: Union[List[str], Callable[], List[str]]])[source]

Bases: prompt_toolkit.completion.base.Completer

A WordCompleter that works properly with almanac’s command grammar.

This class is necessary due to the way that the prompt toolkit WordCompleter relies on filtering based on the current word under the cursor, which will break in scenarios in the almanac grammar when trying to yield completion values for a key=val input (since the word under the cursor is “key=val”).

get_completions(document: prompt_toolkit.document.Document, complete_event: prompt_toolkit.completion.base.CompleteEvent) → Iterable[prompt_toolkit.completion.base.Completion][source]

This should be a generator that yields Completion instances.

If the generation of completions is something expensive (that takes a lot of time), consider wrapping this Completer class in a ThreadedCompleter. In that case, the completer algorithm runs in a background thread and completions will be displayed as soon as they arrive.

Parameters
  • documentDocument instance.

  • complete_eventCompleteEvent instance.