2024-12-12 02:47:55 +01:00
|
|
|
import sys
|
|
|
|
import asyncio
|
|
|
|
|
|
|
|
from .tsmailer import mailer, CONFIG
|
|
|
|
|
|
|
|
|
|
|
|
__doc__ = (
|
|
|
|
"Send mails in batches. "
|
|
|
|
"Configuration should be in a yaml config file"
|
|
|
|
"given with the CONFIG enviroenment variable."
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def main() -> None:
|
2024-12-12 03:05:33 +01:00
|
|
|
from argparse import ArgumentParser
|
|
|
|
|
|
|
|
parser = ArgumentParser(description=__doc__)
|
|
|
|
parser.add_argument(
|
|
|
|
"-v", "--version", action="store_true", help="Print version and exit"
|
|
|
|
)
|
|
|
|
args = parser.parse_args()
|
|
|
|
if args.version:
|
|
|
|
from importlib.metadata import version
|
|
|
|
|
|
|
|
print(version("tinysteady-mailer"))
|
|
|
|
sys.exit(0)
|
|
|
|
|
2024-12-12 02:47:55 +01:00
|
|
|
if CONFIG is None:
|
|
|
|
print(__doc__)
|
|
|
|
sys.exit(0)
|
|
|
|
asyncio.run(mailer())
|