diff --git a/.github/workflows/entrypoint.yml b/.github/workflows/entrypoint.yml new file mode 100644 index 0000000..9425846 --- /dev/null +++ b/.github/workflows/entrypoint.yml @@ -0,0 +1,12 @@ +name: Test entrypoints +on: [push, pull_request] +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - run: python -m pip install -U pip + - run: python -m pip install . + - run: matrix-webhook -h + - run: python -m matrix_webhook -h diff --git a/README.md b/README.md index 3392da6..f87cc0f 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ docker pull nim65s/matrix-webhook Create a matrix user for the bot, and launch this app it with the following arguments or environment variables: ``` +matrix-webhook -h +# OR python -m matrix_webhook -h # OR docker run --rm -it nim65s/matrix-webhook -h diff --git a/matrix_webhook/__main__.py b/matrix_webhook/__main__.py index da99dcc..18d4fcc 100644 --- a/matrix_webhook/__main__.py +++ b/matrix_webhook/__main__.py @@ -3,7 +3,13 @@ import logging from . import app, conf -if __name__ == "__main__": + +def main(): + """Start everything.""" log_format = "%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(message)s" logging.basicConfig(level=50 - 10 * conf.VERBOSE, format=log_format) app.run() + + +if __name__ == "__main__": + main() diff --git a/pyproject.toml b/pyproject.toml index f929ad2..2896dc2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,3 +27,6 @@ ignore = ["D200", "D203", "D204", "D212"] [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" + +[tool.poetry.scripts] +matrix-webhook = "matrix_webhook.__main__:main"