diff --git a/schwarz/mailqueue/cli/__init__.py b/schwarz/mailqueue/cli/__init__.py new file mode 100644 index 0000000..2eb5b91 --- /dev/null +++ b/schwarz/mailqueue/cli/__init__.py @@ -0,0 +1,3 @@ + +from .one_shot_queue_run import * +from .send_test_message import * diff --git a/schwarz/mailqueue/cli/one_shot_queue_run.py b/schwarz/mailqueue/cli/one_shot_queue_run.py new file mode 100644 index 0000000..dc6891f --- /dev/null +++ b/schwarz/mailqueue/cli/one_shot_queue_run.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# SPDX-License-Identifier: MIT + +import sys + +import docopt + +from ..queue_runner import one_shot_queue_run + + +__all__ = [ + 'one_shot_queue_run_main', +] + +def one_shot_queue_run_main(argv=sys.argv, return_rc_code=False): + """mq-run. + + Usage: + mq-run [options] + + Options: + --verbose -v more verbose program output + """ + arguments = docopt.docopt(one_shot_queue_run_main.__doc__, argv=argv[1:]) + config_path = arguments[''] + queue_dir = arguments[''] + cli_options = { + 'verbose': arguments['--verbose'], + } + one_shot_queue_run(queue_dir, config_path, options=cli_options) + exit_code = 0 + return exit_code if (return_rc_code) else sys.exit(exit_code) diff --git a/schwarz/mailqueue/cli.py b/schwarz/mailqueue/cli/send_test_message.py similarity index 58% rename from schwarz/mailqueue/cli.py rename to schwarz/mailqueue/cli/send_test_message.py index 1ac5496..2d7de47 100644 --- a/schwarz/mailqueue/cli.py +++ b/schwarz/mailqueue/cli/send_test_message.py @@ -5,35 +5,13 @@ import docopt -from .mailflow_check import send_test_message -from .queue_runner import one_shot_queue_run +from ..mailflow_check import send_test_message __all__ = [ - 'one_shot_queue_run_main', 'send_test_message_main', ] -def one_shot_queue_run_main(argv=sys.argv, return_rc_code=False): - """mq-run. - - Usage: - mq-run [options] - - Options: - --verbose -v more verbose program output - """ - arguments = docopt.docopt(one_shot_queue_run_main.__doc__, argv=argv[1:]) - config_path = arguments[''] - queue_dir = arguments[''] - cli_options = { - 'verbose': arguments['--verbose'], - } - one_shot_queue_run(queue_dir, config_path, options=cli_options) - exit_code = 0 - return exit_code if (return_rc_code) else sys.exit(exit_code) - - def send_test_message_main(argv=sys.argv, return_rc_code=False): """mq-send-test.