示例#1
0
    def __init__(self,
                 name='db',
                 help_text='Perform database migrations',
                 *args,
                 **kwargs):
        """Init object.

        :param name: Name of the command group (default 'db').
        :param help_text: Help text.
        :param args: Arguments.
        :param kwargs: Keyword arguments.
        :return:
        """
        if 'migrate_instance' not in kwargs:
            raise RuntimeError('You must supply a Migrate instance.')

        self.migrate_instance = kwargs.pop('migrate_instance')
        super(MigrateGroup, self).__init__(name=name,
                                           help=help_text,
                                           *args,
                                           **kwargs)

        for func in REGISTERED_COMMANDS:
            self.add_command(_make_command(func, None, {}, cls=Command))
示例#2
0
 def decorator(f):
     r = _make_command(f, name, attrs, cls)
     r.__doc__ = f.__doc__
     return r
示例#3
0
 def decorator(f):
     r = _make_command(f, name, attrs, cls)
     r.__doc__ = f.__doc__
     return r
示例#4
0
 def decorator(f: Callable[..., None]) -> Callable[..., None]:
     f = _inject_params(f)
     cmd = _make_command(f, name, attrs, cls)
     cmd.__doc__ = f.__doc__
     return cmd