class CommandFunction(Protocol):
- """A function that may be registered in the CLI as an alembic command. It must be a
- named function and it must accept a :class:`.Config` object as the first argument.
+ """A function that may be registered in the CLI as an alembic command.
+ It must be a named function and it must accept a :class:`.Config` object
+ as the first argument.
"""
__name__: str
def register_command(self, fn: CommandFunction) -> None:
"""Registers a function as a CLI subcommand. The subcommand name
- matches the function name, the arguments are extracted from the signature
- and the help text is read from the docstring.
+ matches the function name, the arguments are extracted from the
+ signature and the help text is read from the docstring.
.. seealso::
cli = config.CommandLine()
fake_stdout = []
-
+
def frobnicate(config: config.Config, revision: str) -> None:
"""Frobnicates the revision.
cli.main(["frobnicate", "abc42"])
- assert fake_stdout == [
- f"Revision abc42 frobnicated."
- ]
+ assert fake_stdout == ["Revision abc42 frobnicated."]