crossbar.shell.repl

Attributes

Exceptions

ExitReplException

Common base class for all non-exit exceptions.

InternalCommandException

Common base class for all non-exit exceptions.

Classes

ClickCompleter

Base class for completer implementations.

Functions

_exit_internal()

_get_bottom_toolbar_tokens(cli)

_get_registered_target(name[, default])

_help_internal()

_register_internal_command(names, target[, description])

continuation_tokens(cli, width)

The continuation: display dots before all the following lines.

dispatch_repl_commands(command)

Execute system commands entered in the repl.

handle_internal_commands(command)

Run repl-internal commands.

register_repl(group[, name])

Register repl() as sub-command name of group.

repl(old_ctx[, prompt_kwargs, allow_system_commands, ...])

Start an interactive shell. All subcommands are available in it.

Module Contents

class ClickCompleter(cli)[source]

Bases: prompt_toolkit.completion.Completer

Base class for completer implementations.

cli[source]
get_completions(document, complete_event=None)[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.

exception ExitReplException[source]

Bases: InternalCommandException

Common base class for all non-exit exceptions.

exception InternalCommandException[source]

Bases: Exception

Common base class for all non-exit exceptions.

_exit_internal()[source]
_get_bottom_toolbar_tokens(cli)[source]
_get_registered_target(name, default=None)[source]
_help_internal()[source]
_internal_commands[source]
_register_internal_command(names, target, description=None)[source]
_style[source]
continuation_tokens(cli, width)[source]

The continuation: display dots before all the following lines.

dispatch_repl_commands(command)[source]

Execute system commands entered in the repl.

System commands are all commands starting with “!”.

handle_internal_commands(command)[source]

Run repl-internal commands.

Repl-internal commands are all commands starting with “:”.

register_repl(group, name='repl')[source]

Register repl() as sub-command name of group.

async repl(old_ctx, prompt_kwargs=None, allow_system_commands=True, allow_internal_commands=True, once=False, get_bottom_toolbar_tokens=_get_bottom_toolbar_tokens, get_prompt_tokens=None, style=_style)[source]

Start an interactive shell. All subcommands are available in it.

Parameters:
  • old_ctx – The current Click context.

  • prompt_kwargs – Parameters passed to prompt_toolkit.shortcuts.prompt().

If stdin is not a TTY, no prompt will be printed, but only commands read from stdin.