From e133508d39ccec1785bb71abb5aa040941c77195 Mon Sep 17 00:00:00 2001 From: tretrauit Date: Tue, 20 Sep 2022 17:16:16 +0700 Subject: [PATCH] poetry: add cli script --- pyproject.toml | 3 +++ worthless/__main__.py | 2 +- worthless/cli.py | 8 ++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fa8a143..fd42950 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,6 +15,9 @@ detools = "^0.51.0" [tool.poetry.group.dev.dependencies] pytest = "^7.1.3" +[tool.poetry.scripts] +worthless = 'worthless.cli:main' + [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" diff --git a/worthless/__main__.py b/worthless/__main__.py index 2760c3f..845b5be 100755 --- a/worthless/__main__.py +++ b/worthless/__main__.py @@ -3,4 +3,4 @@ import asyncio from worthless import cli if __name__ == "__main__": - asyncio.run(cli.main()) + cli.main() diff --git a/worthless/cli.py b/worthless/cli.py index 08b6e2e..fe12083 100755 --- a/worthless/cli.py +++ b/worthless/cli.py @@ -322,7 +322,7 @@ class UI: await self._patcher.clear_cache() -async def main(): +async def main_async(): default_dirs = appdirs.AppDirs(constants.APP_NAME, constants.APP_AUTHOR) parser = argparse.ArgumentParser( prog="worthless", description="A worthless launcher written in Python." @@ -584,5 +584,9 @@ async def main(): await ui.verify_game() +def main(): + asyncio.run(main_async()) + + if __name__ == "__main__": - asyncio.run(main()) + main()