betty.cli.commands package

Submodules

Module contents

Provide the Command Line Interface.

betty.cli.commands.COMMAND_REPOSITORY: PluginRepository[Command] = <betty.plugin.proxy.ProxyPluginRepository object>

The Command Line Interface command repository.

Read more about CLI command plugins.

class betty.cli.commands.Command[source]

Bases: Plugin

Define a CLI command plugin.

Read more about CLI command plugins.

abstractmethod async click_command() Command[source]

Get the plugin’s Click command.

betty.cli.commands.command(name: Callable[..., Coroutine[Any, Any, Any]]) Command[source]
betty.cli.commands.command(name: str | None, **attrs: Any) Callable[[Callable[..., Coroutine[Any, Any, Any]]], click.Command]
betty.cli.commands.command(name: None = None, **attrs: Any) Callable[[Callable[..., Coroutine[Any, Any, Any]]], click.Command]
betty.cli.commands.command(name: str | None = None, **attrs: Any) Callable[[Callable[..., Coroutine[Any, Any, Any]]], click.Command]

Mark something a Betty command.

This is almost identical to asyncclick.command().

Functions decorated with @command may choose to raise betty.error.UserFacingError, which will automatically be localized and reraised as asyncclick.ClickException.

Read more about CLI command plugins.

betty.cli.commands.parameter_callback(f: Callable[Concatenate[_T, _P], _ReturnT], *args: _P.args, **kwargs: _P.kwargs) Callable[[click.Context, click.Parameter, _T], _ReturnT][source]

Convert a callback that takes a parameter (option, argument) value and returns it after processing.

This handles errors so Click can gracefully exit.

betty.cli.commands.project_option(f: Callable[Concatenate[Project, _P], Coroutine[Any, Any, _ReturnT]]) Callable[_P, Coroutine[Any, Any, _ReturnT]][source]

Decorate a command that requires a betty.project.Project.