added click for command line arguments

main
missytake 2023-09-01 14:51:22 +02:00
parent a328c255af
commit 9b34195fdf
4 changed files with 32 additions and 8 deletions

View File

@ -19,15 +19,15 @@ package_dir =
= src
packages = find:
python_requires = >=3.8
#install_requires =
# dependency
install_requires =
click
[options.packages.find]
where = src
[options.entry_points]
console_scripts =
remember-remember-bot = remember_remember_bot.loop:loop
remember-remember-bot = remember_remember_bot.cli:main
[tox:tox]
envlist = lint, py310

View File

@ -1,2 +0,0 @@
def main() -> None:
print("Hello World")

View File

@ -1,3 +0,0 @@
from . import main
main()

View File

@ -0,0 +1,29 @@
import click
import remember_remember_bot.loop
@click.command()
@click.option("--email", type=str, default=None, help="the email account for the bot")
@click.option("--password", type=str, default=None, help="the password of the email account")
@click.option("--db", type=str, default="remember.db/db.sqlite", help="path to the bot's database")
@click.option("--debug", is_flag=True, default=False, help="show low level delta chat ffi events")
@click.pass_context
def run(ctx, email: str, password: str, db: str, debug: bool):
"""Remember, remember, the 5th of November... a Delta Chat bot to send daily reminders.
:param ctx: the click context
:param email: the email account for the bot, e.g. bot@example.org
:param password: the password for the email account
:param db: the path to the database
:param debug: whether to show low-level deltachat FFI events
"""
# setup
remember_remember_bot.loop.loop()
def main():
run(auto_envvar_prefix='REMEMBER')
if __name__ == "__main__":
main()