feat: new alternate syntax and switch to black + isort (yeah, maybe not the best time, but that is done).
This commit is contained in:
@ -19,9 +19,9 @@ def entrypoint(args=None):
|
||||
logger.setLevel(settings.LOGGING_LEVEL.get())
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--debug', '-D', action='store_true')
|
||||
parser.add_argument("--debug", "-D", action="store_true")
|
||||
|
||||
subparsers = parser.add_subparsers(dest='command')
|
||||
subparsers = parser.add_subparsers(dest="command")
|
||||
subparsers.required = True
|
||||
|
||||
commands = {}
|
||||
@ -39,23 +39,24 @@ def entrypoint(args=None):
|
||||
# old school, function based.
|
||||
commands[ext.name] = ext.plugin(parser)
|
||||
except Exception:
|
||||
logger.exception('Error while loading command {}.'.format(ext.name))
|
||||
logger.exception("Error while loading command {}.".format(ext.name))
|
||||
|
||||
from stevedore import ExtensionManager
|
||||
mgr = ExtensionManager(namespace='bonobo.commands')
|
||||
|
||||
mgr = ExtensionManager(namespace="bonobo.commands")
|
||||
mgr.map(register_extension)
|
||||
|
||||
parsed_args = parser.parse_args(args).__dict__
|
||||
|
||||
if parsed_args.pop('debug', False):
|
||||
if parsed_args.pop("debug", False):
|
||||
settings.DEBUG.set(True)
|
||||
settings.LOGGING_LEVEL.set(logging.DEBUG)
|
||||
logger.setLevel(settings.LOGGING_LEVEL.get())
|
||||
|
||||
logger.debug('Command: ' + parsed_args['command'] + ' Arguments: ' + repr(parsed_args))
|
||||
logger.debug("Command: " + parsed_args["command"] + " Arguments: " + repr(parsed_args))
|
||||
|
||||
# Get command handler, execute, rince.
|
||||
command = commands[parsed_args.pop('command')]
|
||||
command = commands[parsed_args.pop("command")]
|
||||
command(**parsed_args)
|
||||
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user