Skip to content

xtr_console.bundle

The xtr-console bundle for xtr-dependency-injection.

ConsoleBundle

ConsoleBundle()

Bases: Bundle[ConsoleConfig]

Assembles an :class:Application from the container and every declared command.

Start with an empty per-kernel :class:CommandsLocator.

build

build(builder: ContainerBuilder) -> None

Register the autoconfigurator that fills the per-kernel commands locator.

load_extension

load_extension(config: ConsoleConfig, services: ServiceConfigurator, builder: ContainerBuilder) -> None

Register the per-kernel commands locator and an :class:Application factory.

ConsoleConfig dataclass

ConsoleConfig(name: str | None = None, version: str | None = None, description: str | None = None, catch_exceptions: bool = True)

Values the :class:Application factory reads from the container.

Attributes:

  • name (str | None) –

    The application's name. When None, kernel.name is used.

  • version (str | None) –

    The version displayed in the help header and by --version. None disables that option.

  • description (str | None) –

    One-line description shown in the help header.

  • catch_exceptions (bool) –

    Report an exception escaping a command and exit :attr:~xtr_console.ExitCode.FAILURE instead of propagating.

console async

console(application: Injected[Application]) -> int

Run application on the running event loop; the entry passed to kernel.run.