formatting CLI output

This commit is contained in:
missytake 2023-10-07 10:09:29 +02:00
parent e5f7533826
commit 398f8673ae

View file

@ -17,24 +17,24 @@ def set_log_level(verbose: int, db: str):
logging.info("the delta chat database path is %s", db) logging.info("the delta chat database path is %s", db)
@click.group() @click.command(cls=click.Group, context_settings={"help_option_names": ["-h", "--help"]})
@click.pass_context @click.pass_context
def cli(ctx): def teams_bot(ctx):
"""This bot connects your team to the outside and makes it addressable.""" """This bot connects your team to the outside and makes it addressable."""
@cli.command() @teams_bot.command()
@click.option("--email", type=str, default=None, help="the email account for the bot") @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("--password", type=str, default=None, help="the password of the email account")
@click.option("--db", type=str, default="bot.db/db.sqlite", help="path to the bot's database") @click.option("--db", type=str, default="bot.db/db.sqlite", help="path to the bot's database")
@click.option("-v", "--verbose", count=True, help="show low level delta chat ffi events") @click.option("-v", "--verbose", count=True, help="show low level delta chat ffi events")
@click.pass_context @click.pass_context
def init(ctx, email: str, password: str, db: str, verbose: int): def init(ctx, email: str, password: str, db: str, verbose: int):
"""Configure the bot, create a crew, and add the user to crew by scanning a QR code.""" """Configure bot; create crew; add user to crew by scanning a QR code."""
set_log_level(verbose, db) set_log_level(verbose, db)
@cli.command() @teams_bot.command()
@click.option( @click.option(
"--db", type=str, default="bot.db/db.sqlite", help="path to the bot's database" "--db", type=str, default="bot.db/db.sqlite", help="path to the bot's database"
) )
@ -47,7 +47,7 @@ def run(ctx, db: str, verbose: int):
def main(): def main():
cli(auto_envvar_prefix="TEAMS") teams_bot(auto_envvar_prefix="TEAMS")
if __name__ == "__main__": if __name__ == "__main__":