Terminal UI

Changed in version 0.6.0: Refactored as a separate sub-package to match on par with the webui module.

Changed in version 0.5.0: Refactored to support advanced terminal features like auto-completion.

See also

Check out the tutorial Adding custom commands about adding custom commands.

aiomonitor.termui.commands

aiomonitor.termui.commands.auto_async_command_done(cmdfunc)[source]
aiomonitor.termui.commands.auto_command_done(cmdfunc)[source]
aiomonitor.termui.commands.custom_help_option(cmdfunc)[source]

A custom help option to ensure setting command_done_event.

async aiomonitor.termui.commands.interact(self, connection)[source]

The interactive loop for each telnet client connection.

Return type:

None

monitor_cli

To see the usage of each command, run them with “–help” option.

monitor_cli [OPTIONS] COMMAND [ARGS]...

Commands

cancel

Cancel an indicated task

console

Switch to async Python REPL

exit

Leave the monitor client session

help

Show the list of commands

ps

Show task table

ps-terminated

List recently terminated/cancelled tasks

signal

Send a Unix signal

stacktrace

Print a stack trace from the event loop…

where

Show stack frames and the task creation…

where-terminated

Show stack frames and the…

aiomonitor.termui.completion

You may inspect or modify the auto-completion helpers here.

class aiomonitor.termui.completion.ClickCompleter(root_command)[source]
get_completions(document, complete_event)[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:
  • document (Document) – Document instance.

  • complete_event (CompleteEvent) – CompleteEvent instance.

Return type:

Iterable[Completion]

aiomonitor.termui.completion.complete_signal_names(ctx, param, incomplete)[source]
Return type:

Iterable[str]

aiomonitor.termui.completion.complete_task_id(ctx, param, incomplete)[source]
Return type:

Iterable[str]

aiomonitor.termui.completion.complete_trace_id(ctx, param, incomplete)[source]
Return type:

Iterable[str]