CommandLine
should be more easily extendable with custom commands
#1610
Labels
command interface
use case
not quite a feature and not quite a bug, something we just didn't think of
Describe the use case
I would like to be able to plug custom commands that support the specifics of my project's alembic workflows.
A previous discussion suggested that subclassing
CommandLine
and extending it with custom logic is a good enough solution, and I agree with that. However, the whole initialization of the CLI, including the registration of commands, happens in the singleCommandLine._generate_args
- which makes it hard to add extra commands without duplicating the whole process or inventing inferior workarounds.I would suggest to refactor the method and split it into smaller ones, with one of the parts being something called
CommandLine._register_command
. This would be still called internally to register commands fromalembic.command
but would also be available to subclasses to register other externally provided functions as commands.Example Use
I would like to be able to define a subclass like so
which would make
my_custom_command
immediately available in the cli.Have a nice day!
The text was updated successfully, but these errors were encountered: